Matching techniques in data compression accelerator of a data processing unit

ABSTRACT

A highly programmable device, referred to generally as a data processing unit, having multiple processing units for processing streams of information, such as network packets or storage packets, is described. The data processing unit includes one or more specialized hardware accelerators configured to perform acceleration for various data-processing functions. This disclosure describes a hardware-based programmable data compression accelerator for the data processing unit including a pipeline for performing string substitution. The disclosed string substitution pipeline, referred to herein as a “search block,” is configured to perform string search and replacement functions to compress an input data stream. In some examples, the search block is a part of a compression process performed by the data compression accelerator. The search block may support single and multi-thread processing, and multiple levels of compression effort. In order to achieve high-throughput, the search block processes multiple input bytes per clock cycle per thread.

TECHNICAL FIELD

The disclosure relates to processing packets of information, forexample, in the fields of networking and storage.

BACKGROUND

In a typical computer network, a large collection of interconnectedservers provides computing and/or storage capacity for execution ofvarious applications. A data center is one example of a large-scalecomputer network and typically hosts applications and services forsubscribers, i.e., customers of the data center. The data center may,for example, host all of the infrastructure equipment, such as computenodes, networking and storage systems, power systems, and environmentalcontrol systems. In most data centers, clusters of storage systems andapplication servers are interconnected via a high-speed switch fabricprovided by one or more tiers of physical network switches and routers.Data centers vary greatly in size, with some public data centerscontaining hundreds of thousands of servers, and are usually distributedacross multiple geographies for redundancy.

Many devices within a computer network, e.g., storage/compute servers,firewalls, intrusion detection devices, switches, routers or othernetwork attached devices, often use general purpose processors,including multi-core processing systems, to process data, such asnetwork or storage data. However, general purpose processing cores andmulti-processing systems are normally not designed for high-capacitynetwork and storage workloads of modern network and can be relativelypoor at performing packet stream processing.

SUMMARY

In general, this disclosure describes a highly programmable device,referred to generally as a data processing unit, having multipleprocessing units for processing streams of information, such as networkpackets or storage packets. In some examples, the processing units maybe processing cores, and in other examples, the processing units may bevirtual processors, hardware threads, hardware blocks, or othersub-processing core units. As described herein, the data processing unitincludes one or more specialized hardware accelerators configured toperform acceleration for various data-processing functions.

In various examples, this disclosure describes a hardware-basedprogrammable data compression accelerator of the data processing unitthat includes a pipeline for performing history-based compression onstreams of information, such as network packets. The data compressionaccelerator comprises computer hardware used by the data processing unitto perform data compression functions more efficiently than in typicalsoftware-based compression running on general-purpose processors. Thedisclosed history-based compression pipeline, referred to herein as a“search block,” is configured to perform string search and replacementfunctions to compress an input data stream. In some examples, the searchblock performs a first stage of a two-stage compression processimplemented by the data compression accelerator. The second stage of thecompression process includes application of entropy coding, such as byusing either a Huffman coding block or a Range coding block, asexamples.

As further described herein, in various examples, the search block ofthe hardware-based accelerator replaces a string of bytes in the inputdata stream with a previous occurrence of the same string of bytes toachieve compression. To accomplish this, in example implementations, thesearch block includes hardware sub-blocks referred to as a hash block, amatch block, and a path block. The hash block is configured to prepare a‘key’ at each input byte position by selecting ‘N’ number of bytesstarting with the input byte at the respective position and use the keyto calculate a hash index into a hash table. The hash block uses thehash index to access a bucket of the hash table that contains historyaddresses of any previous occurrences of the same string of bytes in theinput data stream. The hash block then sends the history addresses ofthe previous occurrences to the match block and records the current byteposition address into the same bucket in the hash table. The match blockis configured to match the string of bytes at the current position withthe string of bytes at the previous occurrences identified by thehistory addresses and send the matches to the path block. The path blockis configured to pick the best match at each position (i.e., longest andclosest, in that order) and send the best match as compressed output ofthe search block. The search block may support single and multi-threadprocessing, and multiple levels of effort with the level of compressionincreasing with the effort level. In accordance with the techniques ofthis disclosure, in order to achieve high-throughput, the search blockmay process multiple byte positions per clock cycle per thread.

In one example, this disclosure is directed to a method comprisingreceiving, by a search engine implemented as a pipeline of a processingdevice, an input data stream to be compressed; identifying, by thesearch engine, one or more history addresses of potential previousoccurrences of a current byte string beginning at a current byteposition in the input data stream; determining, by the search engine,whether at least one match occurs for the current byte string from amongone or more previous occurrences of byte strings at the historyaddresses; selecting, by the search engine, an output for the currentbyte position, wherein the output for the current byte positioncomprises one of a reference to a match for the current byte string or aliteral of original data at the current byte position; and transmitting,by the search engine, the selected output for the current byte positionin an output data stream.

In another example, this disclosure is directed to a processing devicecomprising a memory, and a search engine implemented as a pipeline ofthe processing device. The search engine is configured to receive aninput data stream to be compressed, identify one or more historyaddresses of potential previous occurrences of a current byte stringbeginning at a current byte position in the input data stream, determinewhether at least one match occurs for the current byte string from amongone or more previous occurrences of byte strings stored at the historyaddresses, select an output for the current byte position, wherein theoutput for the current byte position comprises one of a reference to amatch for the current byte string or a literal of original data at thecurrent byte position, and transmit the selected output for the currentbyte position in the input data stream.

The hash block is configured to index a set of M keys generated usingN-byte strings at M byte positions into the hash table in parallelduring a single clock cycle by dividing the hash table into banks andaccessing the banks in parallel. In this way, the hash block willprocess up to M byte positions per clock cycle. In the case of a bankconflict when attempting to read the hash table for two or more keys inthe same cycle, the hash block may assign a first key position as aprevious occurrence for a second key position. The hash block may beconfigured to avoid hash collisions by performing adaptive hashing inwhich the key size is different for non-text or binary data than fortext data. The hash block may be further configured to resolve hashcollisions by generating a tag for each key and then comparing the tagfor the respective key against the tags of the entries stored in thehash bucket, where the tag bits are unique among colliding keys.Furthermore, the hash block may include a configurable hash table thatsupports single or multi-thread processing and different hash tablesizes depending on the level of compression or effort desired.

In one example, this disclosure is directed to a method comprisinggenerating, by a hash block of a search engine of a processing device, ahash key from a current byte string beginning at a current byte positionin an input data stream to be compressed; computing, by the hash block,a hash index from the hash key using a hash function; accessing, by thehash block, a hash bucket of a hash table identified by the hash index;reading, by the hash block and during the hash table access, one or morehistory addresses of potential previous occurrences of the current bytestring in the input data stream from the hash bucket identified by thehash index, wherein the history addresses comprise byte positions ofprevious occurrences of byte strings; and sending, by the hash block andto a subsequent block of the search engine, the one or more historyaddresses for use in compressing the input data stream based on matchesto the current byte string from among the respective previousoccurrences of byte strings stored at the history addresses.

In another example, this disclosure is directed to a processing devicecomprising a memory configured to store a hash table, and a hash blockof a search engine of the processing device. The hash block isconfigured to generate a hash key from a current byte string beginningat a current byte position in an input data stream to be compressed;compute a hash index from the hash key using a hash function; access ahash bucket of the hash table identified by the hash index; read, duringthe hash table access, one or more history addresses of potentialprevious occurrences of the current byte string in the input data streamfrom the hash bucket identified by the hash index, wherein the historyaddresses comprise byte positions of previous occurrences of bytestrings; and send, to a subsequent block of the search engine, the oneor more history addresses for use in compressing the input data streambased on matches to the current byte string from among the respectiveprevious occurrences of byte strings stored at the history addresses.

The match block is configured to determine whether string matches haveoccurred beginning at each byte position in a forward direction bycomparing the previously processed input data stored at the historyaddresses received from the hash block. As part of the match checking,the match block may also be configured to perform backward matching. Forbackward matching, the match block may be configured to determinewhether a byte sequence of one or more bytes beginning at each byteposition in a backward direction matches a string of bytes at theidentified history address. In this way, for each byte position, thematch block may determine match lengths in both the forward directionand the backward direction beginning at the current byte position.

In one example, this disclosure is directed to a method comprisingreceiving, by a match block of a search engine of a processing device,one or more history addresses of potential previous occurrences of acurrent byte string beginning at a current byte position in an inputdata stream; determining, by the match block, whether at least oneforward match occurs between the current byte position of the currentbyte string and the history addresses of one or more previousoccurrences of byte strings, the forward match including subsequent bytepositions in a forward direction of the input data stream, wherein thehistory addresses comprise byte positions of the previous occurrences ofbyte strings stored in a history buffer; determining, by the matchblock, whether at least one backward match occurs between the currentbyte position of the current byte string and the history addresses ofthe one or more previous occurrences of byte strings, the backward matchincluding preceding byte positions in a backward direction of the inputdata stream; and sending, by the match block and to a subsequent blockof the search engine, an indication of whether the at least one forwardmatch and the at least one backward match occur for the current bytestring for use in compressing the input data stream based on thematches.

In another example, this disclosure is directed to a processing devicecomprising a memory configured to store a history buffer, and a matchblock of a search engine of the processing device. The match block isconfigured to receive one or more history addresses of potentialprevious occurrences of a current byte string beginning at a currentbyte position in an input data stream; determine whether at least oneforward match occurs between the current byte position of the currentbyte string and the history addresses of one or more previousoccurrences of byte strings, the forward match including subsequent bytepositions in a forward direction of the input data stream, wherein thehistory addresses comprise byte positions of the previous occurrences ofbyte strings stored in the history buffer; determine whether at leastone backward match occurs between the current byte position of thecurrent byte string and the history address for the one or more previousoccurrences of byte strings, the backward match including preceding bytepositions in a backward direction of the input data stream; and send, toa subsequent block of the search engine, an indication of whether the atleast one forward match and the at least one backward match occur forthe current byte string for use in compressing the input data streambased on the matches.

In some examples, the memory banks of the match block may be largeenough to hold the entire history size allowed by a specific compressionalgorithm. In other examples, however, the memory banks may be smallerthan the allowed history size. The entire history may be stored in thememory banks by striping the history data across the memory banks. Sincemost of the previous occurrence matches are close to the current byteposition, this data striping increases the available history size ofsmaller memory banks while reducing bank conflicts when attempting toaccess the history to perform match checking for two or more addressesin the same cycle.

In one example, this disclosure is directed to a method comprisingstoring, by a match block of a search engine of a processing device, ahistory of an input data stream in a history buffer across two or morememory banks of the history buffer depending on an operational mode ofthe match block and a size of the history; receiving, by the matchblock, one or more history addresses of potential previous occurrencesof a current byte string beginning at a current byte position in theinput data stream; determining, by the match block, whether at least onematch occurs for the current byte string from among one or more previousoccurrences of byte strings stored at the one or more history addressesin the history buffer; and sending, by the match block and to asubsequent block of the search engine, an indication of whether the atleast one match occurs for the current byte string for use incompressing the input data stream based on the match.

In another example, this disclosure is directed to a processing devicecomprising a memory configured to store a history buffer, and a matchblock of a search engine of the processing device. The match block isconfigured to store a history of an input data stream in the historybuffer across two or more memory banks of the history buffer dependingon an operational mode of the match block and a size of the history;receive one or more history addresses of potential previous occurrencesof a current byte string beginning at a current byte position in theinput data stream; determine whether at least one match occurs for thecurrent byte string from among one or more previous occurrences of bytestrings stored at the one or more history addresses in the historybuffer; and send, to a subsequent block of the search engine, anindication of whether the at least one match occurs for the current bytestring for use in compressing the input data stream based on the match.

The path block is configured to select the longest and closest match ateach byte position and merge consecutive matches to form a longer match.When selecting the longest and closest match, the path block mayconsider the following sources of potential matches: forward matchesfrom the current byte position, backward matches from subsequent bytepositions, and carry forward matches from previous byte positions. Inthe case of carry forward matches, the path block may be configured todetermine whether any matches from previous byte positions in the inputdata stream overlap a current byte position, and, if so, determine atruncated length of the match at the current byte position. The pathblock may also be configured to support lazy match in which the pathblock determines whether it is better to output a length-distance pairto represent a match beginning at the current byte position or to outputa literal for the current byte position based on matches at other bytepositions within a configurable window. When a match initially selectedas output for the current byte position has a maximum match length, thepath block may determine whether matches at any subsequent bytepositions extend the length of the initial match, and, if so, merge thematches to form a longer match at the current byte position.

In one example, this disclosure is directed to a method comprisingreceiving, by a path block of a search engine of a processing device, anindication of whether at least one match occurs between a current bytestring beginning at a current byte position in an input data stream andone or more history addresses of one or more previous occurrences ofbyte strings; when the at least one match occurs for the current bytestring, determining, by the path block, a best match for the currentbyte position; selecting, by the path block, an output for the currentbyte position, wherein the output for the current byte positioncomprises one of a reference to the best match for the current bytestring or a literal of original data at the current byte position; andtransmitting the selected output for the current byte position in anoutput data stream.

In another example, this disclosure is directed to a processing devicecomprising a memory, and a path block of a search engine of theprocessing device. The path block is configured to receive an indicationof whether at least one match occurs between a current byte stringbeginning at a current byte position in an input data stream and one ormore history addresses of one or more previous occurrences of bytestrings; when the at least one match occurs for the current byte string,determine a best match for the current byte position; select an outputfor the current byte position, wherein the output for the current byteposition comprises one of a reference to the best match for the currentbyte string or a literal of original data at the current byte position;and transmit the selected output for the current byte position in anoutput data stream.

The details of one or more examples are set forth in the accompanyingdrawings and the description below. Other features, objects, andadvantages of the invention will be apparent from the description anddrawings, and from the claims.

BRIEF DESCRIPTION OF DRAWINGS

FIG. 1 is a block diagram illustrating an example system including oneor more network devices configured to efficiently process a series ofwork units in a multiple core processor system.

FIG. 2 is a block diagram illustrating an example data processing unitincluding two or more processing cores, in accordance with thetechniques of this disclosure.

FIG. 3 is a block diagram illustrating another example data processingunit including two or more processing clusters, in accordance with thetechniques of this disclosure.

FIG. 4 is a block diagram illustrating an example processing clusterincluding two or more processing cores.

FIG. 5 is a block diagram illustrating an example data compressionaccelerator.

FIGS. 6A and 6B are conceptual diagrams illustrating example data flowsthrough engine blocks within the data compression accelerator of FIG. 5.

FIG. 7A is a block diagram illustrating an example architecture of asearch block of the data compression accelerator from FIG. 5.

FIG. 7B is a block diagram illustrating another example architecture ofthe search block of the data compression accelerator from FIG. 5.

FIG. 8 is a conceptual diagram illustrating examples of history-basedcompression.

FIG. 9 is a block diagram illustrating an example architecture of areceiver block of the search block from FIG. 7B.

FIG. 10 is a block diagram illustrating an example architecture of ahash block of the search block from FIG. 7B.

FIG. 11 is a conceptual diagram illustrating an example of anoverlapping set of 4-byte strings in an input data stream.

FIG. 12 is a conceptual diagram illustrating an example hash table ingreater detail.

FIG. 13 is a block diagram illustrating an example architecture of amatch block of the search block from FIG. 7B.

FIGS. 14A and 14B are conceptual diagrams illustrating different exampleconfigurations of a large history buffer and a small history buffer fora dual thread mode and a single thread mode, respectively.

FIG. 15 is a conceptual diagram illustrating an example of striping dataacross multiple memory banks of the large history buffer of FIG. 14B.

FIG. 16 is a conceptual diagram illustrating an example of a matchdatapath in more detail.

FIG. 17 is a conceptual diagram illustrating an example of backwardmatching performed by the match block of FIG. 13.

FIG. 18 is a block diagram illustrating an example architecture of apath block of the search block from FIG. 7B.

FIG. 19 is a conceptual diagram illustrating an example of carry forwardmatching performed by the path block of FIG. 18.

FIG. 20 is a block diagram illustrating an example architecture of atransmitter block of the search block from FIG. 7B.

FIGS. 21A-21B are conceptual diagrams illustrating an example of a bytealigned format for packing raw literals or length-distance pairs into anoutput data stream output from the transmitter block of FIG. 20.

FIG. 22 is a flowchart illustrating an example history-based datacompression operation performed in accordance with the techniques ofthis disclosure.

FIG. 23 is a flowchart illustrating an example hashing operation forhistory-based data compression performed in accordance with thetechniques of this disclosure.

FIG. 24 is a flowchart illustrating an example matching operation forhistory-based data compression performed in accordance with thetechniques of this disclosure.

FIG. 25 is a flowchart illustrating an example data striping operationfor history-based data compression performed in accordance with thetechniques of this disclosure.

FIG. 26 is a flowchart illustrating an example merging and outputselection operation for history-based data compression performed inaccordance with the techniques of this disclosure.

DETAILED DESCRIPTION

FIG. 1 is a block diagram illustrating an example system 8 including oneor more network devices configured to efficiently process a series ofwork units in a multiple core processor system. As described herein,techniques for caching and prefetching data from non-coherent memory mayprovide technical benefits that include improving the efficiency andutilization of processing cores within access nodes 17 in FIG. 1. Accessnodes may also be referred to as data processing units (DPUs), ordevices including DPUs, in this disclosure. In the example of FIG. 1,various data structures and processing techniques are described withrespect to access nodes 17 within a data center 10. Other devices withina network, such as routers, switches, servers, firewalls, gateways andthe like, having multiple core processor systems may readily beconfigured to utilize the data processing techniques described herein.

Data center 10 represents an example of a system in which varioustechniques described herein may be implemented. In general, data center10 provides an operating environment for applications and services forcustomers 11 coupled to the data center by service provider network 7and gateway device 20. Data center 10 may, for example, hostinfrastructure equipment, such as compute nodes, networking and storagesystems, redundant power supplies, and environmental controls. Serviceprovider network 7 may be coupled to one or more networks administeredby other providers, and may thus form part of a large-scale publicnetwork infrastructure, e.g., the Internet.

In some examples, data center 10 may represent one of manygeographically distributed network data centers. In the example of FIG.1, data center 10 is a facility that provides information services forcustomers 11. Customers 11 may be collective entities such asenterprises and governments or individuals. For example, a network datacenter may host web services for several enterprises and end users.Other exemplary services may include data storage, virtual privatenetworks, file storage services, data mining services, scientific- orsuper-computing services, and so on.

In the illustrated example, data center 10 includes a set of storagesystems and application servers 12 interconnected via a high-speedswitch fabric 14. In some examples, servers 12 are arranged intomultiple different server groups, each including any number of serversup to, for example, n servers 12 ₁-12 _(n). Servers 12 providecomputation and storage facilities for applications and data associatedwith customers 11 and may be physical (bare-metal) servers, virtualmachines running on physical servers, virtualized containers running onphysical servers, or combinations thereof.

In the example of FIG. 1, each of servers 12 is coupled to switch fabric14 by an access node 17 for processing streams of information, such asnetwork packets or storage packets. In example implementations, accessnodes 17 may be configurable to operate in a standalone networkappliance having one or more access nodes. For example, access nodes 17may be arranged into multiple different access node groups 19, eachincluding any number of access nodes up to, for example, x access nodes17 ₁-17 _(x). In other examples, each access node may be implemented asa component (e.g., electronic chip) within a device, such as a computenode, application server, storage server, and may be deployed on amotherboard of the device or within a removable card, such as a storageand/or network interface card.

In general, each access node group 19 may be configured to operate as ahigh-performance I/O hub designed to aggregate and process networkand/or storage I/O for multiple servers 12. As described above, the setof access nodes 17 within each of the access node groups 19 providehighly-programmable, specialized I/O processing circuits for handlingnetworking and communications operations on behalf of servers 12. Inaddition, in some examples, each of access node groups 19 may includestorage devices 27, such as solid state drives (SSDs) and/or hard diskdrives (HDDs), configured to provide network accessible storage for useby applications executing on the servers 12. In some examples, one ormore of the SSDs may comprise non-volatile memory (NVM) or flash memory.Each access node group 19, including its set of access nodes 17 andstorage devices 27, and the set of servers 12 supported by the accessnodes 17 of that access node group 19 may be referred to herein as anetwork storage compute unit.

As further described herein, in one example, each access node 17 is ahighly programmable I/O processor specially designed for offloadingcertain functions from servers 12. In one example, each access node 17includes a number of internal processor clusters, each including two ormore processing cores and equipped with hardware engines that offloadcryptographic functions, compression and regular expression (RegEx)processing, data storage functions including deduplication and erasurecoding, and networking operations. In this way, each access node 17includes components for fully implementing and processing network andstorage stacks on behalf of one or more servers 12. In addition, accessnodes 17 may be programmatically configured to serve as a securitygateway for its respective servers 12, freeing up the processors of theservers to dedicate resources to application workloads. In some exampleimplementations, each access node 17 may be viewed as a networkinterface subsystem that implements full offload of the handling of datapackets (with zero copy in server memory) and storage acceleration forthe attached server systems. In one example, each access node 17 may beimplemented as one or more application-specific integrated circuit(ASIC) or other hardware and software components, each supporting asubset of the servers. In accordance with the techniques of thisdisclosure, any or all of access nodes 17 may include a data compressionaccelerator unit. That is, one or more computing devices may include anaccess node including one or more data compression accelerator units,according to the techniques of this disclosure.

The data compression accelerator unit of the access node, according tothe techniques of this disclosure, may be configured to process payloadsof packets during various services as the packets are exchanged byaccess nodes 17, e.g., between access nodes 17 via switch fabric 14and/or between servers 12. That is, as packets are exchanged between thedevices, either for networking or for data storage and retrieval, theaccess node may perform data compression on payloads of the packet. Forexample, the access node may use one or more data compressionaccelerator units to perform history-based compression followed byentropy encoding. According to the techniques of this disclosure, eachof the hardware-based data compression accelerator units may include apipeline for performing the history-based compression (i.e., stringsearch and replacement) more efficiently than is possible in softwarerunning on a general purpose processor. Although primary describedherein as history-based compression, dictionary-based compressionoperates substantially similar.

In the example of FIG. 1, each access node 17 provides connectivity toswitch fabric 14 for a different group of servers 12 and may be assignedrespective IP addresses and provide routing operations for the servers12 coupled thereto. Access nodes 17 may interface with and utilizeswitch fabric 14 so as to provide full mesh (any-to-any)interconnectivity such that any of servers 12 may communicate packetdata for a given packet flow to any other of the servers using any of anumber of parallel data paths within the data center 10. In addition,access nodes 17 described herein may provide additional services, suchas storage (e.g., integration of solid-state storage devices), security(e.g., encryption), acceleration (e.g., compression), I/O offloading,and the like. In some examples, one or more of access nodes 17 mayinclude storage devices, such as high-speed solid-state drives orrotating hard drives, configured to provide network accessible storagefor use by applications executing on the servers. More details on thedata center network architecture and interconnected access nodesillustrated in FIG. 1 are available in U.S. Provisional PatentApplication No. 62/514,583, filed Jun. 2, 2017, entitled “Non-BlockingAny-to-Any Data Center Network with Packet Spraying Over MultipleAlternate Data Paths,”, the entire content of which is incorporatedherein by reference.

Two example architectures of access nodes 17 are described below withrespect to FIGS. 2, 3, and 4. With respect to either example, thearchitecture of each access node 17 comprises a multiple core processorsystem that represents a high performance, hyper-converged network,storage, and data processor and input/output hub. The architecture ofeach access node 17 is optimized for high performance and highefficiency stream processing.

A stream is defined as an ordered, unidirectional sequence ofcomputational objects that can be of unbounded or undetermined length.In a simple example, a stream originates in a producer and terminates ata consumer, is operated on sequentially, and is flow-controlled. In someexamples, a stream can be defined as a sequence of stream fragments,each representing a portion of data communicated by a stream. In oneexample, a stream fragment may include a memory block contiguouslyaddressable in physical address space, an offset into that block, and avalid length. Streams can be discrete, such as a sequence of packetsreceived from a network, or continuous, such as a stream of bytes readfrom a storage device. A stream of one type may be transformed intoanother type as a result of processing. Independent of the stream type,stream manipulation requires efficient fragment manipulation. Anapplication executing on one of access nodes 17 may operate on a streamin three broad ways: the first is protocol processing, which consists ofoperating on control information or headers within the stream; thesecond is payload processing, which involves significant accessing ofthe data within the stream; and third is some combination of bothcontrol and data access.

Stream processing is a specialized type of conventional general-purposeprocessing supporting specialized limitations with regard to both accessand directionality. Processing typically only accesses a limited portionof the stream at any time, called a “window,” within which it mayperform random accesses. Objects outside of the window are notaccessible through a streaming interface. In contrast, general purposeprocessing views the whole memory as randomly accessible at any time. Inaddition, stream processing generally progresses in one direction,called the forward direction. These characteristics make streamprocessing amenable to pipelining, as different processors within one ofaccess nodes 17 can safely access different windows within the stream.

As described herein, data processing units of access nodes 17 mayprocess stream information by managing “work units.” In general, a workunit (WU) is a container that is associated with a stream state and usedto describe (i.e. point to) data within a stream (stored in memory)along with any associated meta-data and operations to be performed onthe data. In the example of FIG. 1, streams of data units maydynamically originate within a peripheral unit of one of access nodes 17(e.g. injected by a networking unit, a host unit, or a solid state driveinterface), or within a processor of the one of access nodes 17, inassociation with one or more streams of data, and terminate at anotherperipheral unit or another processor of the one of access nodes 17. Eachwork unit maintained by a data processing unit is associated with anamount of work that is relevant to the entity executing the work unitfor processing a respective portion of a stream.

Stream processing is typically initiated as a result of receiving one ormore data units associated with respective portions of the stream andconstructing and managing work units for processing respective portionsof the data stream. In protocol processing, a portion would be a singlebuffer (e.g. packet), for example. Within access nodes 17, work unitsmay be executed by processor cores, hardware blocks, I/O interfaces, orother computational processing units. For instance, a processor core ofan access node 17 executes a work unit by accessing the respectiveportion of the stream from memory and performing one or morecomputations in accordance with the work unit. A component of the one ofaccess nodes 17 may receive, execute or generate work units. Asuccession of work units may define how the access node processes aflow, and smaller flows may be stitched together to form larger flows.

For purposes of example, DPUs within each access node 17 may execute anoperating system, such as a general-purpose operating system or aspecial-purpose operating system, that provides an execution environmentfor data plane software for data processing. Moreover, each DPU may beconfigured to utilize a work unit (WU) stack data structure (referred toas a ‘WU stack’ in a multiple core processor system. As describedherein, the WU stack data structure may provide certain technicalbenefits, such as helping manage an event driven, run-to-completionprogramming model of an operating system executed by the multiple coreprocessor system. The WU stack, in a basic form, may be viewed as astack of continuation WUs used in addition to (not instead of) a programstack maintained by the operating system as an efficient means ofenabling program execution to dynamically move between cores of theaccess node while performing high-rate stream processing. As describedbelow, a WU data structure is a building block in the WU stack and canreadily be used to compose a processing pipeline and services executionin a multiple core processor system. The WU stack structure carriesstate, memory, and other information in auxiliary variables external tothe program stack for any given processor core. In some implementations,the WU stack may also provide an exception model for handling abnormalevents and a ‘success bypass’ to shortcut a long series of operations.Further, the WU stack may be used as an arbitrary flow execution modelfor any combination of pipelined or parallel processing.

As described herein, access nodes 17 may process WUs through a pluralityof processor cores arranged as processing pipelines within access nodes17, and such processing cores may employ techniques to encourageefficient processing of such work units and high utilization ofprocessing resources. For instance, a processing core (or a processingunit within a core) may, in connection with processing a series of workunits, access data and cache the data into a plurality of segments of alevel 1 cache associated with the processing core. In some examples, aprocessing core may process a work unit and cache data from non-coherentmemory in a segment of the level 1 cache. The processing core may alsoconcurrently prefetch data associated with a work unit expected to beprocessed in the future into another segment of the level 1 cacheassociated with the processing core. By prefetching the data associatedwith the future work unit in advance of the work unit being dequeuedfrom a work unit queue for execution by the core, the processing coremay be able to efficiently and quickly process a work unit once the workunit is dequeued and execution of the work unit is to commence by theprocessing core. More details on work units and stream processing bydata processing units of access nodes are available in U.S. ProvisionalPatent Application No. 62/589,427, filed Nov. 21, 2017, entitled “WorkUnit Stack Data Structures in Multiple Core Processor System,” and U.S.Provisional Patent Application No. 62/625,518, entitled “EFFICIENT WORKUNIT PROCESSING IN A MULTICORE SYSTEM”, filed Feb. 2, 2018, the entirecontents of both being incorporated herein by reference.

As described herein, the data processing unit for access nodes 17includes one or more specialized hardware-based accelerators configuredto perform acceleration for various data-processing functions, therebyoffloading tasks from the processing units when processing work units.That is, each accelerator is programmable by the processing cores, andone or more accelerators may be logically chained together to operate onstream data units, such as by providing cryptographic functions,compression and regular expression (RegEx) processing, data storagefunctions and networking operations.

This disclosure describes a hardware-based programmable data compressionaccelerator of a data processing unit that includes a pipeline forperforming history-based compression. The data compression acceleratorcomprises computer hardware used by the data processing unit to performdata compression functions more efficiently than is possible in softwarerunning on a general purpose processor. The disclosed history-basedcompression pipeline, referred to herein as a “search block,” isconfigured to perform string search and replacement functions tocompress an input data stream. In some examples, the search blockperforms a first stage of a two-stage compression process performed bythe data compression accelerator. The second stage of the compressionprocess includes entropy coding, which may be performed using either aHuffman coding block or a Range coding block.

The search block replaces a string of bytes in the input data streamwith a previous occurrence of the same string of bytes to achievecompression. To accomplish this, the search block includes hardwaresub-blocks referred to as a hash block, a match block, and a path block.The hash block is configured to prepare a ‘key’ at each input byteposition by selecting ‘N’ number of bytes starting with the input byteat the respective position, and use the key to calculate a hash indexinto a hash table. The hash block uses the hash index to access a bucketof the hash table that contains history addresses of any previousoccurrences of the same string of bytes in the input data stream. Thehash block then sends the history addresses of the previous occurrencesto the match block, and records the current byte position address intothe same bucket in the hash table. If the hash bucket is already full,the hash block may first drop or remove a history address of one of theprevious occurrences to make room for the current byte position addressin the hash bucket. The match block is configured to match the string ofbytes at the current position with the string of bytes at the previousoccurrences identified by the history addresses, and send the matches tothe path block. The path block is configured to pick the best match ateach position (i.e., longest and closest, in that order) and send thebest match as compressed output of the search block. The search blockmay support single and multi-thread processing, and multiple levels ofeffort with the level of compression increasing with the effort level.In accordance with the techniques of this disclosure, in order toachieve high-throughput, the search block may process multiple bytepositions per clock cycle per thread. The pipeline of the search blockis described in more detail with respect to FIG. 7B.

The hash block is configured to index a set of M keys generated usingN-byte strings at M byte positions into the hash table in parallel in asingle clock cycle by dividing the hash table into banks and accessingthe banks in parallel. In this way, the hash block will process up to Mbyte positions per clock cycle. In the case of a bank conflict whenattempting to read the hash table for two or more keys in the samecycle, the hash block may assign a first key position as a previousoccurrence for a second key position. The hash block may be configuredto avoid hash collisions by performing adaptive hashing in which the keysize is different for non-text or binary data than for text data. Thehash block may be further configured to resolve hash collisions bygenerating a tag for each key and then comparing the tag for therespective key against the tags of the entries stored in the hashbucket, where the tag bits are unique among colliding keys. Furthermore,the hash block may include a configurable hash table that supportssingle or multi-thread processing and different hash table sizesdepending on the level of compression or effort desired. The hash blockis described in more detail with respect to FIG. 10.

The match block is configured to determine whether string matches haveoccurred beginning at each byte position in a forward direction bycomparing the previously processed input data stored at the historyaddresses received from the hash block. As part of the match checking,the match block may also be configured to perform backward matching. Forbackward matching, the match block may be configured to determinewhether an earlier byte sequence of one or more bytes beginning at eachbyte position in a backward direction matches a string of bytes at theidentified history address. In this way, for each byte position, thematch block may determine match lengths in both the forward directionand the backward direction beginning at the current byte position. Thematch block is described in more detail with respect to FIG. 13.

In some examples, the memory banks of the match block may be largeenough to hold the entire history size allowed by a specific compressionalgorithm. In other examples, however, the memory banks may be smallerthan the allowed history size. The entire history may be stored in thememory banks by striping the history data across the memory banks. Sincemost of the previous occurrence matches are close to the current byteposition, this data striping increases the available history size ofsmaller memory banks while reducing bank conflicts when attempting toaccess the history to perform match checking for two or more addressesin the same cycle. Data striping is described in more detail withrespect to FIG. 15.

The path block is configured to select the longest and closest match ateach byte position and merge consecutive matches to form a longer match.When selecting the longest and closest match, the path block mayconsider the following sources of potential matches: forward matchesfrom the current byte position, backward matches from subsequent bytepositions, and carry forward matches from previous byte positions. Inthe case of carry forward matches, the path block may be configured todetermine whether any matches from previous byte positions in the inputdata stream overlap a current byte position, and, if so, determine atruncated length of the match at the current byte position. The pathblock may also be configured to support lazy match in which the pathblock determines whether it is better to output a length-distance pairto represent a match beginning at the current byte position or to outputa literal for the current byte position based on matches at other bytepositions within a configurable window. As one example, the path blockmay determine to output a literal because a better match that compressesa longer sequence of input bytes is available within the next few bytepositions within the configurable window. When a match initiallyselected as output for the current byte position has a maximum matchlength, the path block may determine whether matches at any subsequentbyte positions extend the length of the initial match, and, if so, mergethe matches to form a longer match at the current byte position. Thepath block is described in more detail with respect to FIG. 18.

FIG. 2 is a block diagram illustrating an example data processing unit(DPU) 130 including two or more processing cores, in accordance with thetechniques of this disclosure. DPU 130 generally represents a hardwarechip implemented in digital logic circuitry and may be used in anycomputing or network device. DPU 130 may operate substantially similarto and generally represent any of access nodes 17 of FIG. 1. Thus, DPU130 may be communicatively coupled to one or more network devices,server devices (e.g., servers 12), random access memory, storage media(e.g., solid state drives (SSDs)), a data center fabric (e.g., switchfabric 14), or the like, e.g., via PCI-e, Ethernet (wired or wireless),or other such communication media. Moreover, DPU 130 may be implementedas one or more application-specific integrated circuit (ASIC), may beconfigurable to operate as a component of a network appliance or may beintegrated with other DPUs within a device.

In the illustrated example of FIG. 2, DPU 130 includes a multi-coreprocessor 132 having a plurality of programmable processing cores140A-140N (“cores 140”) coupled to an on-chip memory unit 134. Each ofcores 140 includes a level 1 cache 141 (level 1 caches 141 a, 141 b, and141 n are associated with cores 140 a, 140 b, and 140 n, respectively).

Memory unit 134 may include two types of memory or memory devices,namely coherent cache memory 136 and non-coherent buffer memory 138.Processor 132 also includes a networking unit 142, work unit (WU) queues143, a memory controller 144, and accelerators 146. As illustrated inFIG. 2, each of cores 140, networking unit 142, WU queues 143, memorycontroller 144, memory unit 134, and accelerators 146 arecommunicatively coupled to each other. In some examples, processor 132of DPU 130 further includes one or more accelerators (not shown)configured to perform acceleration for various data-processingfunctions, such as look-ups, matrix multiplication, cryptography,compression, regular expressions, or the like.

In this example, DPU 130 represents a high performance, hyper-convergednetwork, storage, and data processor and input/output hub. For example,networking unit 142 may be configured to receive one or more datapackets from and transmit one or more data packets to one or moreexternal devices, e.g., network devices. Networking unit 142 may performnetwork interface card functionality, packet switching, and the like,and may use large forwarding tables and offer programmability.Networking unit 142 may expose Ethernet ports for connectivity to anetwork, such as switch fabric 14 of FIG. 1. DPU 130 may also includeone or more interfaces for connectivity to host devices (e.g., servers)and data storage devices, e.g., solid state drives (SSDs) via PCIelanes. DPU 130 may further include one or more high bandwidth interfacesfor connectivity to off-chip external memory.

Processor 132 further includes accelerators 146 configured to performacceleration for various data-processing functions, such as look-ups,matrix multiplication, cryptography, compression, regular expressions,or the like. For example, accelerators 146 may comprise hardwareimplementations of look-up engines, matrix multipliers, cryptographicengines, compression engines, or the like. In accordance with thetechniques of this disclosure, at least one of accelerators 146represents a hardware implementation of a data compression engine. Inparticular, according to the techniques of this disclosure, accelerators146 include at least one hardware-based data compression acceleratorthat includes a pipeline for performing history-based compression (i.e.,string search and replacement functions) on an input data stream, asdiscussed in greater detail below.

Memory controller 144 may control access to on-chip memory unit 134 bycores 140, networking unit 142, and any number of external devices,e.g., network devices, servers, external storage devices, or the like.Memory controller 144 may be configured to perform a number ofoperations to perform memory management in accordance with the presentdisclosure. For example, memory controller 144 may be capable of mappingaccesses from one of the cores 140 to either of coherent cache memory136 or non-coherent buffer memory 138. More details on the bifurcatedmemory system included in the DPU are available in U.S. ProvisionalPatent Application No. 62/483,844, filed Apr. 10, 2017, and titled“Relay Consistent Memory Management in a Multiple Processor System,”,the entire content of which is incorporated herein by reference.

Cores 140 may comprise one or more microprocessors without interlockedpipeline stages (MIPS) cores, advanced reduced instruction set computing(RISC) machine (ARM) cores, performance optimization with enhancedRISC—performance computing (PowerPC) cores, RISC Five (RISC-V) cores, orcomplex instruction set computing (CISC or x86) cores. Each of cores 140may be programmed to process one or more events or activities related toa given data packet such as, for example, a networking packet or astorage packet. Each of cores 140 may be programmable using a high-levelprogramming language, e.g., C, C++, or the like.

Each of level 1 caches 141 may include a plurality of cache lineslogically or physically divided into cache segments. Each of level 1caches 141 may be controlled by a load/store unit also included withinthe core. The load/store unit may include logic for loading data intocache segments and/or cache lines from non-coherent buffer memory 138and/or memory external to DPU 130. The load/store unit may also includelogic for flushing cache segments and/or cache lines to non-coherentbuffer memory 138 and/or memory external to DPU 130. In some examples,the load/store unit may be configured to prefetch data from main memoryduring or after a cache segment or cache line is flushed.

As described herein, processor cores 140 may be arranged as processingpipelines, and such processing cores may employ techniques to encourageefficient processing of such work units and high utilization ofprocessing resources. For instance, any of processing cores 140 (or aprocessing unit within a core) may, in connection with processing aseries of work units retrieved from WU queues 143, access data and cachethe data into a plurality of segments of level 1 cache 141 associatedwith the processing core. In some examples, a processing core 140 mayprocess a work unit and cache data from non-coherent memory 138 in asegment of the level 1 cache 141. As described herein, concurrent withexecution of work units by cores 140, a load store unit of memorycontroller 144 may be configured to prefetch, from non-coherent memory138, data associated with work units within WU queues 143 that areexpected to be processed in the future, e.g., the WUs now at the top ofthe WU queues and next in line to be processed. For each core 140, theload store unit of memory controller 144 may store the prefetched dataassociated with the WU to be processed by the core into a standbysegment of the level 1 cache 141 associated with the processing core140.

In some examples, the plurality of cores 140 executes instructions forprocessing a plurality of events related to each data packet of one ormore data packets, received by networking unit 142, in a sequentialmanner in accordance with one or more work units associated with thedata packets. As described above, work units are sets of data exchangedbetween cores 140 and networking unit 142 where each work unit mayrepresent one or more of the events related to a given data packet.

As one example use case, stream processing may be divided into workunits executed at a number of intermediate processors between source anddestination. Depending on the amount of work to be performed at eachstage, the number and type of intermediate processors that are involvedmay vary. In processing a plurality of events related to each datapacket, a first one of the plurality of cores 140, e.g., core 140A mayprocess a first event of the plurality of events. Moreover, first core140A may provide to a second one of plurality of cores 140, e.g., core140B a first work unit of the one or more work units. Furthermore,second core 140B may process a second event of the plurality of eventsin response to receiving the first work unit from first core 140B.

As another example use case, transfer of ownership of a memory bufferbetween processing cores may be mediated by a work unit messagedelivered to one or more of processing cores 140. For example, the workunit message may be a four-word message including a pointer to a memorybuffer. The first word may be a header containing information necessaryfor message delivery and information used for work unit execution, suchas a pointer to a function for execution by a specified one ofprocessing cores 140. Other words in the work unit message may containparameters to be passed to the function call, such as pointers to datain memory, parameter values, or other information used in executing thework unit.

In one example, receiving a work unit is signaled by receiving a messagein a work unit receive queue (e.g., one of WU queues 143). The one of WUqueues 143 is associated with a processing element, such as one of cores140, and is addressable in the header of the work unit message. One ofcores 140 may generate a work unit message by executing storedinstructions to addresses mapped to a work unit transmit queue (e.g.,another one of WU queues 143). The stored instructions write thecontents of the message to the queue. The release of a work unit messagemay be interlocked with (gated by) flushing of the core's dirty cachedata and in some examples, prefetching into the cache of data associatedwith another work unit for future processing.

FIG. 3 is a block diagram illustrating another example of a DPU 150including two or more processing clusters, in accordance with thetechniques of this disclosure. DPU 150 may operate substantially similarto any of the access nodes 17 of FIG. 1. Thus, DPU 150 may becommunicatively coupled to a data center fabric (e.g., switch fabric14), one or more server devices (e.g., servers 12), storage media (e.g.,SSDs), one or more network devices, random access memory, or the like,e.g., via PCI-e, Ethernet (wired or wireless), or other suchcommunication media in order to interconnect each of these variouselements. DPU 150 generally represents a hardware chip implemented indigital logic circuitry. As various examples, DPU 150 may be provided asan integrated circuit mounted on a motherboard of a computing,networking and/or storage device or installed on a card connected to themotherboard of the device.

In general, DPU 150 represents a high performance, hyper-convergednetwork, storage, and data processor and input/output hub. Asillustrated in FIG. 3, DPU 150 includes networking unit 152, processingclusters 156A-1 to 156N-M (processing clusters 156), host units 154A-1to 154B-M (host units 154), and central cluster 158, and is coupled toexternal memory 170. Each of host units 154, processing clusters 156,central cluster 158, and networking unit 152 may include a plurality ofprocessing cores, e.g., MIPS cores, ARM cores, PowerPC cores, RISC-Vcores, or CISC or x86 cores. External memory 170 may comprise randomaccess memory (RAM) or dynamic random access memory (DRAM).

As shown in FIG. 3, host units 154, processing clusters 156, centralcluster 158, networking unit 152, and external memory 170 arecommunicatively interconnected via one or more specializednetwork-on-chip fabrics. A set of direct links 162 (represented asdashed lines in FIG. 3) forms a signaling network fabric that directlyconnects central cluster 158 to each of the other components of DPU 150,that is, host units 154, processing clusters 156, networking unit 152,and external memory 170. A set of grid links 160 (represented as solidlines in FIG. 3) forms a data network fabric that connects neighboringcomponents (including host units 154, processing clusters 156,networking unit 152, and external memory 170) to each other in atwo-dimensional grid.

Networking unit 152 has Ethernet interfaces 164 to connect to the switchfabric, and interfaces to the data network formed by grid links 160 andthe signaling network formed by direct links 162. Networking unit 152provides a Layer 3 (i.e., OSI networking model Layer 3) switchforwarding path, as well as network interface card (NIC) assistance. Oneor more hardware direct memory access (DMA) engine instances (not shown)may be attached to the data network ports of networking unit 152, whichare coupled to respective grid links 160. The DMA engines of networkingunit 152 are configured to fetch packet data for transmission. Thepacket data may be in on-chip or off-chip buffer memory (e.g., withinbuffer memory of one of processing clusters 156 or external memory 170),or in host memory.

Host units 154 each have PCI-e interfaces 166 to connect to serversand/or storage devices, such as SSD devices. This allows DPU 150 tooperate as an endpoint or as a root. For example, DPU 150 may connect toa host system (e.g., a server) as an endpoint device, and DPU 150 mayconnect as a root to endpoint devices (e.g., SSD devices). Each of hostunits 154 may also include a respective hardware DMA engine (not shown).Each DMA engine is configured to fetch data and buffer descriptors fromhost memory, and to deliver data and completions to host memory.

DPU 150 provides optimizations for stream processing. DPU 150 executesan operating system that facilitates run-to-completion processing, whichmay eliminate interrupts, thread scheduling, cache thrashing, andassociated costs. For example, an operating system may run on one ormore of processing clusters 156. Central cluster 158 may be configureddifferently from processing clusters 156, which may be referred to asstream processing clusters. In one example, central cluster 158 executesthe operating system kernel (e.g., Linux kernel) as a control plane.Processing clusters 156 may function in run-to-completion thread mode ofa data plane software stack of the operating system. That is, processingclusters 156 may operate in a tight loop fed by work unit queuesassociated with each processing core in a cooperative multi-taskingfashion.

DPU 150 operates on work units (WUs) that associate a buffer with aninstruction stream to reduce dispatching overhead and allow processingby reference to minimize data movement and copy. The stream-processingmodel may structure access by multiple processors (e.g., processingclusters 156) to the same data and resources, avoid simultaneoussharing, and therefore, reduce contention. A processor may relinquishcontrol of data referenced by a work unit as the work unit is passed tothe next processor in line. Central cluster 158 may include a centraldispatch unit responsible for work unit queuing and flow control, workunit and completion notification dispatch, and load balancing andprocessor selection from among processing cores of processing clusters156 and/or central cluster 158.

As described above, work units are sets of data exchanged betweenprocessing clusters 156, networking unit 152, host units 154, centralcluster 158, and external memory 170. Each work unit may be representedby a fixed length data structure, or message, including an action valueand one or more arguments. In one example, a work unit message includesfour words, a first word having a value representing an action value andthree additional words each representing an argument. The action valuemay be considered a work unit message header containing informationnecessary for message delivery and information used for work unitexecution, such as a work unit handler identifier, and source anddestination identifiers of the work unit. The other arguments of thework unit data structure may include a frame argument having a valueacting as a pointer to a continuation work unit to invoke a subsequentwork unit handler, a flow argument having a value acting as a pointer tostate that is relevant to the work unit handler, and a packet argumenthaving a value acting as a packet pointer for packet and/or blockprocessing handlers.

In some examples, one or more processing cores of processing clusters180 may be configured to execute program instructions using a work unit(WU) stack. In general, a work unit (WU) stack is a data structure tohelp manage event driven, run-to-completion programming model of anoperating system typically executed by processing clusters 156 of DPU150, as further described in U.S. Patent Application Ser. No.62/589,427, filed Nov. 21, 2017, the entire content of which isincorporated herein by reference.

As described herein, in some example implementations, load store unitswithin processing clusters 156 may, concurrent with execution of workunits by cores within the processing clusters, identify work units thatare enqueued in WU queues for future processing by the cores. In someexamples, WU queues storing work units enqueued for processing by thecores within processing clusters 156 may be maintained as hardwarequeues centrally managed by central cluster 158. In such examples, loadstore units may interact with central cluster 158 to identify futurework units to be executed by the cores within the processing clusters.The load store units prefetch, from the non-coherent memory portion ofexternal memory 170, data associated with the future work units. Foreach core within processing clusters 156, the load store units of thecore may store the prefetched data associated with the WU to beprocessed by the core into a standby segment of the level 1 cacheassociated with the processing core.

FIG. 4 is a block diagram illustrating an example processing cluster 180including two or more processing cores 182A-182N. Each of processingclusters 156 of DPU 150 of FIG. 3 may be configured in a mannersubstantially similar to that shown in FIG. 4. In the example of FIG. 4,processing cluster 180 includes cores 182A-182N (“cores 182”), a memoryunit 183 including a coherent cache memory 184 and a non-coherent buffermemory 186, a cluster manager 185 including WU queue manager 187 formaintaining (e.g., within hardware registers of processing cluster 180)and manipulating WU queues 188, and accelerators 189A-189X(“accelerators 189”). Each of cores 182 includes L1 buffer cache 198(i.e., core 182 includes L1 buffer cache 198A and in general, core 182Nincludes L1 buffer cache 198N). In some examples, cluster manager 185 isalternatively located within central cluster 158, and/or WU queues 188are alternatively maintained within central cluster 158 (e.g., withinhardware registers of central cluster 158).

An access node or DPU (such as access nodes 17 of FIG. 1, DPU 130 ofFIG. 2, or DPU 150 of FIG. 3) may support two distinct memory systems: acoherent memory system and a non-coherent buffer memory system. In theexample of FIG. 4, coherent cache memory 184 represents part of thecoherent memory system while non-coherent buffer memory 186 representspart of the non-coherent buffer memory system. Cores 182 may representthe processing cores discussed with respect to DPU 150 of FIG. 3. Cores182 may share non-coherent buffer memory 186. As one example, cores 182may use non-coherent buffer memory 186 for sharing streaming data, suchas network packets.

In general, accelerators 189 perform acceleration for variousdata-processing functions, such as table lookups, matrix multiplication,cryptography, compression, regular expressions, or the like. That is,accelerators 189 may comprise hardware implementations of lookupengines, matrix multipliers, cryptographic engines, compression engines,regular expression interpreters, or the like. For example, accelerators189 may include a lookup engine that performs hash table lookups inhardware to provide a high lookup rate. The lookup engine may be invokedthrough work units from external interfaces and virtual processors ofcores 182, and generates lookup notifications through work units.Accelerators 189 may also include one or more cryptographic units tosupport various cryptographic processes. Accelerators 189 may alsoinclude one or more compression units to perform compression and/ordecompression.

An example process by which a processing cluster 180 processes a workunit is described here. Initially, cluster manager 185 of processingcluster 180 may queue a work unit (WU) in a hardware queue of WU queues188. When cluster manager 185 “pops” the work unit from the hardwarequeue of WU queues 188, cluster manager 185 delivers the work unit toone of accelerators 189, e.g., a lookup engine. The accelerator 189 towhich the work unit is delivered processes the work unit and determinesthat the work unit is to be delivered to one of cores 182 (inparticular, core 182A, in this example) of processing cluster 180. Thus,the one of accelerators 189 forwards the work unit to a local switch ofthe signaling network on the DPU, which forwards the work unit to bequeued in a virtual processor queue of WU queues 188.

As noted above, in accordance with the techniques of this disclosure,one or more of accelerators 189 may be configured to perform datacompression. A hardware-based data compression accelerator ofaccelerators 189, in accordance with the techniques of this disclosure,may include a pipeline for performing history-based compression. Thedisclosed history-based compression pipeline is configured to performstring search and replacement functions to compress an input datastream, as indicated by one or more work units. That is, thehistory-based compression pipeline scans the input data stream forrepeated strings within a history window based on a local historybuffer, and replaces the repeated strings with length-distance pairsthat point to previous occurrences of the strings, as discussed ingreater detail below.

After cluster manager 185 pops the work unit from the virtual processorqueue of WU queues 188, cluster manager 185 delivers the work unit via acore interface to core 182A, in this example. An interface unit of core182A then delivers the work unit to one of the virtual processors ofcore 182A.

Core 182A processes the work unit, which may involve accessing data,such as a network packet or storage packet, in non-coherent memory 156Aand/or external memory 170. Core 182A may first look for thecorresponding data in cache 198A, and in the event of a cache miss, mayaccess the data from non-coherent memory 156A and/or external memory170. In some examples, while processing the work unit, core 182A maystore information (i.e., the network packet or data packet) associatedwith the work unit in an active segment of cache 198A. Further, core182A may, while processing the work unit, prefetch data associated witha second work unit into a different, standby segment of cache 198A. Whencore 182A completes processing of the work unit, core 182A initiates (orcauses initiation of) a cache flush for the active segment, and may alsoinitiate prefetching of data associated with a third work unit (to beprocessed later) into that active segment. Core 182A (or a virtualprocessor within core 182A) may then swap the active segment and thestandby segment so that the previous standby segment becomes the activesegment for processing of the next work unit (i.e., the second workunit). Because data associated with the second work unit was prefetchedinto this now active segment, core 182A (or a virtual processor withincore 182A) may be able to more efficiently process the second work unit.Core 182A then outputs corresponding results (possibly including one ormore work unit messages) from performance of the work unit back throughthe interface unit of core 182A.

As described herein, in some example implementations, load store unitswithin memory unit 183 may, concurrent with execution of work units bycores 182 within the processing cluster 180, identify work units thatare enqueued in WU queues 188 for future processing by the cores. Theload store units prefetch, from a non-coherent memory portion ofexternal memory 170, data associated with the future work units andstore the prefetched data associated with the WUs to be processed by thecores into a standby segment of the level 1 cache associated with theparticular processing cores.

FIG. 5 is a block diagram illustrating an example data compressionaccelerator 200. For example, data compression accelerator 200 may beone of accelerators 146 of data processing unit 130 from FIG. 3, or oneof accelerators 189 of processing cluster 180 from FIG. 4. In someexamples, data compression accelerator 200 may be included in each ofprocessing clusters 156 of data processing unit 150 from FIG. 3 forlocal, hardware-based execution of compression work units generated bysoftware executing on the processing cores of the respective cluster

Data compression accelerator 200 is configured to accelerate thecomputationally intensive data compression and decompression operationsconventionally performed by software running on general-purposeprocessors. As illustrated in FIG. 5, in this example, data compressionaccelerator 200 includes a control panel 202, a search block 206, arange encode/decode (RED) block 208, a Huffman encode/decode block 210,and a JPG re-encode/decode block 212, each of which represent differenthardware circuitry within, for example, an integrated circuit device.With these components, as described in more detail below, datacompression accelerator 200 may support DEFLATE compression anddecompression used by gzip and zlib, support Lempel-Ziv-Markov chainalgorithm (LZMA) compression and decompression, and support JPGre-compression and decompression. DEFLATE compression comprises alossless data compression algorithm that uses a combination of ahistory-based compression scheme performed by search block 206 andHuffman encoding performed by Huffman block 210. For example, thehistory-based compression scheme may comprise one of the LZ77, LZ78,LZW, LZ4, LZO, or LZS algorithms. The DEFLATE compression anddecompression is described in more detail in P. Deutsch, “DEFLATECompressed Data Format Specification version 1.3,” IETF Network WorkingGroup, RFC 1951, May 1996. LZMA compression comprises another losslessdata compression algorithm that uses a combination of a history-basedcompression scheme performed by search block 206 and range encodingperformed by RED block 208. JPG re-compression comprises lossycompression for digital images performed by JPG block 212.

Control panel (CP) 202 of data compression accelerator 200 operates asan interface to the other blocks in data compression accelerator 200,and is the only block in data compression accelerator 200 with externalinterfaces. CP 202 controls the mode of operation, manages WUs, andtracks resources and schedules jobs for each of the engine blocks (i.e.,search block 206, RED block 208, Huffman block 210, and JPG block 212)within data compression accelerator 200. CP 202 also provides ingressDMA 203 and egress DMA 204. The engine blocks within data compressionaccelerator 200 work on a stream of data and there are no randomaccesses to external memories or to external blocks. External interfacesof CP 202 are used for receiving WUs, sending WUs, receiving payloaddata, sending result data, and receiving configuration data. Internalinterfaces between the engine blocks within data compression accelerator200 are mostly streaming interfaces. The internal interfaces may usecredit-based flow control. For example, at the beginning of a job theremay be N flow control units (‘flits’) of header data that describe thejob.

CP 202 is responsible for controlling access to shared resources thatcan be used by multiple of the engine blocks within data compressionaccelerator 200. Any scheduling of resources local to a specific one ofthe engine blocks may be done locally by that engine block. For example,search block 206 and RED block 208 may share a history buffer local tosearch block 206. As another example, RED block 208 and Huffman block210 may share one or more history buffers local to RED block 208.Certain WUs may depend on one or more of the shared resources. As such,CP 202 may control the resource assignment and only schedule WUs that donot conflict with the current resource assignment. The engine blockswithin data compression accelerator 200 may not be able to detect orresolve shared resource conflicts themselves. In addition, several ofthe engine blocks within data compression accelerator 200, e.g., searchblock 206, RED block 208, and Huffman block 210, may have multiplethreads. Some of the engine blocks, e.g., at least search block 206, mayhave both a single thread mode and a multi thread mode, depending on thetype of job being processed.

Search block 206 may be the first stage of a two-stage compressionprocess performed by data compression accelerator 200. For example,search block 206 may be configured to perform a history-basedcompression algorithm (e.g., the LZ77 algorithm or variants thereof) tosearch for and replace repeated occurrences of strings of bytes in aninput data stream. Search block 206 uses a local a history buffer thatincludes previously seen data as the history for the compressionalgorithm. Search block 206 is configured to scan the input data streamfor repeated strings within a history window, and replace the repeatedstrings with length-distance pairs that point to previous occurrences ofthe strings. The output of search block 206 includes one or both ofliterals (i.e., strings of bytes) and length-distance pairs used toreplace repeated strings of bytes. The output of search block 206 maythen goes through a second stage of compression using entropy encoding,either using Huffman encoding performed by Huffman block 210 or rangeencoding performed by RED block 208.

The history-based decompression operation involves expanding thelength-distance pairs into strings of bytes based on a history buffer.For example, the history-based decompression operation may be performedby RED block 208 since the latency of the decompression operationaffects the throughput of search block 206. In the case where thehistory buffer for the history-based decompression operation is small(e.g., less than or equal to 32 KB), RED block 208 may use a historybuffer that is local to RED block 208. In the case where the historybuffer for the history-based decompression operation is large (e.g.,greater than 32 KB), RED block 208 may use its local buffer as a cacheand use the history buffer at search block 206 for up to the maximumsupported history buffer size, e.g., 256 KB. When RED block 208 uses thehistory buffer at search block 206, search block 206 may be disabled.Therefore, the history-based encode/decode operation using a smallhistory buffer may be full duplex, and the history-based encode/decodeoperation using a large history buffer is half duplex.

Following the history-based compression (e.g., the LZ77 algorithm)performed by search block 206, the encode (ENC) portion of Huffman block210 may perform the second stage of the two-stage compression processfor DEFLATE compression used by gzip and zlib. The output of searchblock 206 is the input to the encode portion of Huffman block 210. Theencode portion of Huffman block 210 performs Huffman encoding, which isa type of entropy encoding that replaces high frequency symbols withshorter codes and low frequency symbols with longer codes. As a firststep, the encode portion of Huffman block 210 gathers a frequencyhistogram for every symbol in a block of data, and stores the data in abuffer as the statistics are counted. As a second step, the encodeportion of Huffman block 210 assigns codes based on the frequency ofeach symbol. In parallel with this step, the next block of data arrivesin a second buffer. As a third step, the encode portion of Huffman block210 outputs the encoding table, which also gets compressed. As a fourthstep, the encode portion of Huffman block 210 outputs the encoded data.As the buffer is being drained, the next block begins filling thebuffer. There are two buffers per thread. In some examples, Huffmanblock 210 has two threads such that there is a total of four buffers.

The decode (DEC) portion of Huffman block 210 may perform a first stageof a decompression process for DEFLATE format compressed data used bygzip and zlib. The decode portion of Huffman block 210 decodes a binarybit stream of encoded symbols and replaces them with the originalsymbols. The encoded symbols are of variable length, so the length ofthe previous symbol determines where the next symbol to be decodedbegins in the bit stream. This chain of dependencies typically makesfast decoding challenging. The output of the decode portion of Huffmanblock 210 is a sequence of literals and/or length-distance pair symbols.The literals directly represent the original data (i.e., strings ofbytes), and the length-distance pairs are pointers to previousoccurrences of a string of bytes within a sliding history window. Thesecond stage of the decompression process for DEFLATE is to expand thelength-distance pairs. For DEFLATE, the symbol decode and the expansionare independent operations and, therefore, the operations may beperformed by separate engine blocks. As discussed above with respect tothe history-based decompression operation, the expansion may beperformed by RED block 208.

RED block 208 performs range encoding and range decoding. The rangeencode (ENC) portion of RED block 208 is a bit stream encoder thatcompresses one bit at a time. The range encoding algorithm is comparableto arithmetic encoding. The range encode portion of RED block 208 uses acontext memory that provides a probability of a 1 or 0 based the currentcontext. The context memory is updated on the fly during compression andthat process is precisely mirrored during decompression. In general,range encoding provides higher compression than Huffman encoding at thecost of lower throughput, larger area, and higher complexity.

Following the history-based compression (e.g., the LZ77 algorithm)performed by search block 206, the encode portion of RED block 208 mayperform the second stage of the two-stage compression process for LZMAcompression. Data compression accelerator 200 may have two modes ofoperation for LZMA compression. In a streaming mode, the output ofsearch block 206 is directly sent to RED block 208 using one WU. In somecases, however, there may be a speed mismatch where search block 206 isrunning faster than RED block 208. To optimize this case, a second modeof operation decouples the search stage from the RED stage using aseparate WU for each stage. In the second mode of operation, theintermediate results are directly stored to and accessed from anexternal memory via ingress DMA 203 and egress DMA 204. In the secondmode of operation, RED block 208 may use multiple encoding threads tobetter match the throughput of search block 206.

The decode (DEC) portion of RED block 208 may perform a first stage of adecompression process for LZMA format compressed data. The decodeportion of RED block 208 receives the data to be decoded from ingressDMA 203 and sends the results out over egress DMA 204. Depending on thesize of the history buffer used during LZMA compression, RED block 208may use small internal history buffers, which allows for full duplexencode/decode, or RED block 208 may use a large external history bufferfrom search block 206, which only allows for half duplex encode/decode.Search block 206 may be disabled when RED block 208 is decoding usingthe large external history buffer local to search block 206.

Similar to Huffman decoding for DEFLATE, range decoding for LZMAdecompression involves decoding symbols and expanding symbols thatreference a history buffer. Unlike Huffman decoding, the expansion ofthe symbols in range decoding may affect the context used to decode thenext symbol. In addition to performing range decoding for LZMAdecompression, the decode portion of RED block 208 also performs thesecond stage of Huffman decoding for DEFLATE, i.e., the length-distancepair expansion. In this case, the decode portion of RED block 208receives the input from Huffman block 210, and generates the finalresult that is sent out over egress DMA 204.

JPG block 212 may losslessly re-encode jpg files into a proprietaryformat. Standard jpg files may be compressed in two phases, first alossy phase and then second a lossless phase using Huffman encoding. JPGblock 212 is configured to replace the lossless phase with a moreadvanced compression algorithm. Similar to RED block 208, JPG block 212uses an adaptive context-based bit-wise encoder, but it has beenspecifically optimized for image data. JPG block 212 performscompression and decompression of image data independently from the otherengine blocks within data compression accelerator 200 and is only incommunication with CP 202.

FIGS. 6A and 6B are conceptual diagrams illustrating example data flowsthrough engine blocks within data compression accelerator 200 of FIG. 5.FIG. 6A illustrates example compression data flows. As illustrated inFIG. 6A, data compression accelerator 200 may perform history-basedcompression alone using only search block 206, DEFLATE compression usinga combination of search block 206 and the encode portion of Huffmanblock 210, LZMA compression using a combination of search block 206 andthe encode portion of RED block 208, range encoding alone using REDblock 208, or JPG re-compression using JPG block 212. FIG. 6Billustrates example decompression data flows. As illustrated in FIG. 6B,data compression accelerator 200 may perform the first stage of DEFLATEdecompression using the decode portion of Huffman block 210, the firststage of LZMA decompression using the decode portion of RED block 208,or JPG decompression using JPG block 212. In the case of both DEFLATEand LZMA decompression, RED block 208 may perform the second stage ofdecompression, i.e., length-distance pair expansion.

FIG. 7A is a block diagram illustrating an example architecture ofsearch block 206 of data compression accelerator 200 from FIG. 5.According to the disclosed techniques, search block 206 includesmultiple hardware search engines (i.e., threads) 214 each configured toperform history-based compression of an input data stream. Asillustrated, search block 206 also includes input buffers 216, outputbuffers 218, a hash table 224, and a history buffer 230. Thearchitecture of search block 206 illustrated in FIG. 7A is shown forexemplary purposes only. In other examples, search block 206 may beconfigured in a variety of ways.

In some examples, search block 206 may include multiple search engines214, multiple input buffers 216, and multiple output buffers 218. Eachof the input buffers 216 includes a current block of data to becompressed by the respective one of search engines 214, and each ofoutput buffers 216 includes a current block of compressed data outputfrom the respective one of search engines 214. Search engines 214 maycompress multiple separate input data streams in parallel, or a singleinput data stream may be split into multiple blocks and search engines214 may work independently on separate blocks in parallel to improvethroughput for the single input data stream. In the case of usingmultiple engines for a single input data stream, the output of each ofsearch engines 214 will be merged after compression into a single outputdata stream. In either case, when using multiple engines, the portionsof history buffer 230 used by each of search engines 214 cannot beshared between the threads.

Search block 206 may operate in at least two different modes including ahigh throughput mode that uses the multiple search engines 214 (i.e.,multi-thread), and a high compression mode that uses only one of searchengines 214 (i.e., single thread). Hash table 224 and history buffer 230may each be configured differently depending on the operational mode ofsearch block 206.

In the high throughput mode, search block 206 may compress data faster,e.g., at 25 Gbps, with a moderate compression ratio. The higherthroughput may be achieved by processing multiple byte positions of theinput data stream per clock cycle per thread. In addition, the byteposition processing may be performed using fewer history addresses,e.g., 4 addresses, of potential byte string matches included in eachbucket of hash table 224 and a smaller history, e.g., up to 32 KB,copied into multiple memory banks of history buffer 230. Each of searchengines 214 may drop conflicting hash entries in the case of a bankconflict.

As an example, in the high throughput mode, at each byte position of thedata to be compressed, one of search engines 214 creates a hash key ofthe current byte and the next few bytes depending on the byte values.The one of search engines 214 then looks up the hash key in hash table224 to get addresses of the most recent occurrences in history buffer230 of a byte string beginning at the current byte position. The one ofsearch engines 214 then matches the byte string identified by theaddresses in history buffer 230 with the byte string at the current byteposition in the data to be compressed. The one of search engines 214 isconfigured to perform this hashing and matching for multiple bytepositions in the same clock cycle. The one of search engines 214 thenselects the best option for the current byte position. For example, ifthe longest and closest match at the current byte position has a lengththat is greater than the hash key size, then the one of search engines214 outputs a length-distance pair for the current byte position.Otherwise, the one of search engines 214 outputs a literal for thecurrent byte position and repeats the process described above at thenext byte position.

In the high compression mode, search block 206 may achieve a highercompression ratio at a lesser throughput, for example, approximately 1Gbps. The higher compression ratio may be achieved by processingmultiple byte positions per clock cycle for the single thread using alarger number of history addresses (e.g., 16 or 32 history addresses) ofpotential byte string matches included in each bucket of hash table 224and a larger history, e.g., up to 256 KB, that is stripped acrossmultiple memory banks of history buffer 230. In some cases, in the highcompression mode, the one of search engines 214 may use multiple cyclesto retry byte string matches in hash table 224 in the case of a bankconflict.

FIG. 7B is a block diagram illustrating another example architecture ofsearch block 206 of data compression accelerator 200 from FIG. 5.According to the disclosed techniques, search block 206 comprises apipeline for performing history-based compression of an input datastream. As illustrated, search block 206 includes a receiver block 220,a hash block 222, a match block 228, a path block 232, and a transmitterblock 234. In general, search engines 214 from FIG. 7A may be configuredto perform the functions of the pipeline illustrated in FIG. 7B. Thearchitecture of search block 206 illustrated in FIG. 7B is shown forexemplary purposes only. In other examples, search block 206 may beconfigured in a variety of ways.

As described above, search block 206 is configured to performhistory-based compression, e.g., one of the LZ77, LZ78, LZW, LZ4, LZO,or LZS algorithms, to search for and replace repeated occurrences ofstrings of bytes in an input data stream. Search block 206 uses ahistory buffer 230 that includes previously seen data as a dynamic,self-referential history for the history-based compression algorithm. Inhistory-based compression, the history is maintained as a sequence ofbytes, and byte strings in the input data stream are replaced byindices, e.g., length-distance pairs, that identify locations of thesame byte strings in the history byte sequence. In the case of adynamic, self-referential history, the history is built as the inputdata stream is being compressed. In some examples, search block 206 mayperform the history-based compression as a first stage of a two-stagecompression process. The second stage of the two-stage compressionprocess may be entropy coding of the output of search block 206, whichmay be performed by either Huffman block 210 for DEFLATE compression orRED block 208 for LZMA compression.

The overall history-based compression algorithm performed by searchblock 206 will now be described. In general, the algorithm starts atbyte position 0 of the input data stream and continues to the end of thefile. The input data stream to be compressed is received by receiverblock 220 of search block 206 from ingress DMA 203 of CP 202. Receiverblock 220 is configured to handle flow control with CP 202 for theingress interface and respond to flow control from transmitter block 234for the pipeline of search block 206. Receiver block 220 also writesdata of the input data stream to a lookahead buffer in match block 228and sends the data to hash block 222 for the main pipeline. Receiverblock 220 is described in more detail with respect to FIG. 9.

As illustrated in FIG. 7B, hash block 222 includes hash controller 223and hash table 224. Hash controller 223 is configured to prepare a hashkey at a current byte position of the input data stream by selecting ‘N’number of bytes starting with the current byte. Hash controller 223 thenuses the hash key to calculate a hash index into hash table 224. Hashcontroller 223 then uses the hash index to access a bucket of hash table224 that includes history addresses of any previous occurrences of thesame string of bytes from the input data stream. History addresses thatresult from hash collisions may be filtered out. Hash controller 223sends the history addresses of the previous occurrences to the matchblock 228, and writes the current byte position address into the samebucket in hash table 224. If the bucket is full, the oldest historyaddress is dropped from the bucket in hash table 224 to add the currentbyte position address. Additional functions of hash block 222, includingdifferent processing modes, adaptive hashing, and collision handling,are described in more detail below with respect to FIG. 10.

As illustrated in FIG. 7B, match block 228 includes match controller 229and history buffer 230. For each of the history addresses received fromhash block 222, match controller 229 is configured to read a string ofbytes of previously seen data identified by the respective historyaddress from history buffer 230. The retrieved string of bytes of thepreviously seen data is compared to current data starting from thecurrent byte position in a forward direction of the input data stream todetermine forward matches. Backward matches may also be detected betweenthe previously seen data and the current data starting from the currentbyte position in a backward direction of the input data stream. In someexamples, matches longer than M bytes may be truncated, where M is afunction of data alignment. Match controller 229 receives a list ofmatches between the current input data stream and the previously seendata included in history buffer 230. Match controller 229 determinesmatch length for each of the matches. For example, for each of thematches, match controller 229 may detect a “match byte” as a firstnon-matching byte after a match or a “previous byte” as the last bytethat gets matched. Match controller 229 sends the match lengths for thelist of matches to path block 232. Additional functions of match block228, including different processing modes and backward matching, aredescribed in more detail below with respect to FIG. 13. In certainprocessing modes, data striping may be used to spread accesses evenlyacross multiple banks of history buffer 230. The data striping isdescribed in more detail with respect to FIG. 15.

Path block 232 is configured to pick the best match (i.e., longest andclosest, in that order) for each byte position of the input data streamfrom the match lengths received from match block 228. For example, pathblock 232 may be configured to find the longest match, if any, for thecurrent byte position of the input data stream, including anyoverlapping history buffer matches from adjacent byte positions. Forexample, path block 232 may be configured to assemble longer matches bymerging multiple smaller matches at previous and subsequent bytepositions with the match at the current byte position. Path block 232may support lazy optimizations in order to pick the best match based onmultiple byte positions within a configurable window, as opposed topicking the best match based only on the current byte position.

For the selected matches at each byte position, path block 232 outputslength-distance pairs that replace the matched byte stings in the inputdata stream with pointers to the previous occurrences of the bytestrings in the history. If a match is not selected for a given byteposition, path block 232 instead sends a literal that directlyrepresents the byte at the given byte position. When search block 206 isperforming LZMA compression, path block 232 may also report the firstnon-matching byte after the selected match and the previous byte, i.e.,the last byte of the selected match. Path block 232 sends the literalsand length-distance pairs to transmitter block 234. Additional functionsof path block 232, including carry forward matching and consecutivematch merging, are described in more detail below with respect to FIG.18.

Transmitter block 234 is configured to pack the output received frompath block 232 into a data stream that includes a sequence of literalsand length-distance pairs for matches in history buffer 230. Transmitterblock 234 is also configured to handle flow control with receiver block220 for the pipeline of search block 206 and respond to flow controlfrom CP 202 for the egress interface. The packed data stream of thehistory compressed output is transmitted by transmitter block 234 to CP202. The transmitter block is described in more detail with respect toFIG. 20. At CP 202, the history compressed output may be directly storedto an external memory via egress DMA 204, recirculated to RED block 208,or recirculated to Huffman block 210.

In accordance with techniques of this disclosure, the engine blockswithin search block 206 are configurable to operate in different modesdepending on the level of compression or effort desired for the inputdata stream. For example, in order to achieve high-throughput, each ofthe engine blocks within search block 206 may operate according to amulti-thread mode, which supports processing of multiple input datastreams in parallel, and process multiple input byte positions per clockcycle per thread at lower compression levels. In the high-throughputmode, hash block 222 may perform multiple hash table accesses per cycleper thread but return a relatively small number of history addresses peraccess as potential matches, and match block 228 may support arelatively small history buffer 230 with which to determine the stringmatches from the history addresses. If a higher level of compression isdesired, each of the engine blocks within search block 206 may operateaccording to a single thread mode, which supports processing of a singleinput data stream, and process multiple input byte positions per clockcycle for only the single thread using a more compute intensive stringmatching process. In the high-compression mode, hash block 222 mayperform multiple hash table accesses per cycle for the single thread butreturn a relatively large number of history addresses as potentialmatches, and match block 228 may support a relatively large historybuffer 230 with which to determine the string matches from the historyaddresses. The different operational modes of the engine blocks withinsearch block 206, and related hashing and matching solutions, aredescribed in more detail below.

FIG. 8 is a conceptual diagram illustrating examples of history-basedcompression. The examples illustrated in FIG. 8 are compressed accordingto the LZ77 algorithm that uses a dynamic, self-referential history thatis built using the input data being compressed. For example, the historymay include a sequence of words that each has an index that indicatesthe location of the word in the history byte sequence. Each of the wordsmay have a length of 2 to 6 bytes. During compression, if a repeatedstring of bytes is found, then the repeated string of bytes in the inputdata stream is replaced by a back reference to the previous location inthe history where the identical string of bytes is present. The backreference comprises a length-distance pair that indicates a distancefrom the current byte to the start of the identical string of bytes inthe history and a length of the repeated byte string.

As a first example, FIG. 8 illustrates a first sequence of bytes 232. Inthe uncompressed form, first sequence of bytes 236 comprises text thatreads “Wikipedia is an encyclopedia.” In this example, the byte stringof “pedia” appears for the first time beginning at byte position “4” andis repeated a second time towards the end of the sequence beginning atbyte position “23”. In the compressed form, the second instance of thebyte string “pedia” is replaced with a back reference to the earlierinstance of the byte string “pedia” using the (distance, length) pair(19, 5). As illustrated, the distance to the beginning of the first,earlier instance of the byte string (i.e., byte position 4) is 19 bytesfrom the beginning of the second, repeat instance of the byte string(i.e., byte position 23), and the length of the repeated byte string“pedia” is 5.

As a second example, FIG. 8 illustrates a second sequence of bytes 238.In the uncompressed form, second sequence of bytes 238 comprises textthat reads “255.255.255.254”. In this example, the byte string “255.”appears for the first time beginning at byte position “0” and isrepeated two times beginning at byte positions “4” and “8” followed bybyte string “25” beginning at byte position “12”. The distance to thebeginning of the first, earliest instance of the byte string “255.”(i.e., byte position 0) is 4 bytes from the beginning of the second,repeat instance of the byte string “255.” (i.e., byte position 4), butthe length of the repeated byte string “255.255.25” is 10 bytes, i.e.,the repeated byte string is overlapping with itself. In the compressedform, therefore, the subsequent two instances of the byte string “255.”beginning at byte position 4 and 8 and the byte string “25” beginning atbyte position 12 are replaced with a back reference to the earliestinstance of the byte string “255.” using the (distance, length) pair (4,10).

FIG. 9 is a block diagram illustrating an example architecture ofreceiver block 220 of search block 206 from FIG. 7B. In the illustratedexample, receiver block 220 includes an input buffer 240, an orderingbuffer 242, and a configuration (CFG) unit 244. The architecture ofreceiver block 220 illustrated in FIG. 9 is shown for exemplary purposesonly. In other examples, receiver block 220 may be configured in avariety of ways.

Input buffer 240 of receiver block 220 receives an input data stream ofan input data stream to be compressed from ingress DMA 203 of CP 202 ofFIG. 5. Input buffer 240 may comprise a small multi-entry FIFO (firstin, first out) buffer. Input buffer 240 is configured to handle flowcontrol with CP 202 for the ingress interface. More specifically, inputbuffer 240 uses credit-based flow control by returning credits to CP 202based on the amount of space available to store data in input buffer240. In this way, CP 202 will not send more input data than receiverblock 220 and, thus, the pipeline of search block 206 can handle. Inputbuffer 240 is also configured to respond to flow control fromtransmitter block 234 for the pipeline of search block 206 to avoidprocessing more data than transmitter block 234 can handle. Input buffer240 again uses credit-based flow control based on credits returned fromtransmitter block 234 based on the amount of space available to storedata in an output buffer of transmitter block 234.

Configuration unit 244 is configured to process control flits anddistribute control signals to provide overall control for the pipelineof search block 206. As an example, a first flit of header data for theinput data stream may include configuration data used to configure thepipeline of search block 206 for that input data stream. Configurationblock 244 receives the first flit at the start of the input data streamfrom input buffer 240 and distributes the configuration data to the restof the pipeline of search block 206. The first flit may includeconfiguration data that indicates a level of effort or compression forthe input data stream, a hash key size, a history buffer size, a lazymatch window size, checksum information, a compression type, and othercommands and information.

From input buffer 240, the input data stream is written to a lookaheadbuffer in match block 228 and also sent to hash block 222 for the mainpipeline via ordering buffer 242. Ordering buffer 242 is configured tohandle ordering constraints between the input data streams sent to hashblock 222 and to match block 228. In general ordering buffer 242 isconfigured to have a certain size such that the size of the orderingbuffer and a size of a hash key buffer within hash block 222 are greaterthan or equal to a size of the lookahead buffer in match block 228.

Hash block 222 operates on a current byte position in the input datastream and operates using a hash key buffer of a certain size, e.g., 16bytes. In this example, the input data to hash block 222 needs to be 16bytes ahead of the current byte position. In match block 228, thelookahead buffer includes a certain amount of the input data, e.g., 32bytes, starting at the current byte position. In accordance with thisdisclosure, and as described in more detail below, search block 206 isconfigured to process multiple bytes of current position, e.g., 4, percycle. As such, match block may need at least 35 bytes of data startingfrom the current byte position. Using the numbers provided in thisexample, ordering buffer 242 may be configured to hold 20 bytes of theinput data, so that 20 bytes in ordering buffer 242 plus 16 bytes in thehash key buffer of hash block 222 is greater than or equal to 35 bytesin the lookahead buffer of match block 228. If the ordering between theinput data streams is not maintained, match block 228 may not havecorrect data with which to attempt to perform a match.

FIG. 10 is a block diagram illustrating an example architecture of hashblock 222 of search block 206 from FIG. 7B. In the illustrated example,hash controller 223 of hash block 222 includes a hash key buffer 252, ahash function unit 253, a bank scheduler 254, and a results accumulator255. Hash datapath 250 of hash block 222 includes hash table 224 alongwith a valid entry tracker 257 and hash update logic 258. Thearchitecture of hash block 222 illustrated in FIG. 10 is shown forexemplary purposes only. In other examples, hash block 222 may beconfigured in a variety of ways.

Hash block 222 is configurable to operate in different modes dependingon the level of compression or effort desired for the input data stream.Hash table 224 is also configurable to support single or multi-threadprocessing and different hash table sizes depending on an operationalmode of hash block 222. Hash table 224 includes a list of potentialmatches between byte strings of the current input data stream receivedfrom receiver block 220 and previously processed data stored in historybuffer 230. More specifically, hash table 224 includes a plurality ofhash buckets that each holds the most recent history addresses ofprevious occurrences of a same byte string in history buffer 230.

In one example, hash table 224 may have a total storage of 128 k historyaddresses. For a dual thread mode, hash table 224 may be configured toinclude 16 banks each having 2 k rows or hash buckets, with each of thehash buckets including 4 hash entries (i.e., history addresses). Hashtable 224 may be partitioned into two memories, one for each thread,that are isolated from each other such that each thread may only accessits designated memory. In order to process multiple byte positions perclock cycle per thread, which requires multiple hash accesses per cycleper thread, each of the memories of hash table 224 may be configuredinto multiple banks (e.g., 8 banks of 2 k rows for a total of 16 k hashbuckets with each of the hash buckets holding 4 history addresses). Fora higher effort single thread mode, hash table 224 may comprise a singlememory configured to include 8 k hash buckets with each of the hashbuckets holding 16 history addresses. For the highest effort singlethread mode, hash table 224 may comprise a single memory configured toinclude 4 k hash buckets with each of the hash buckets holding 32history addresses. In order to process multiple byte positions per clockcycle for the single thread, the single memory of hash table 224 maysimilarly be configured into multiple banks (e.g., 8 banks, 4 banks, or2 banks). In other examples, hash table 224 may be arranged inadditional or different configurations.

Hash key buffer 252 of hash controller 223 is configured to prepare ahash key at a current byte position of the input data stream receivedfrom receiver block 220 by selecting ‘N’ number of bytes starting withthe current byte. In some examples, hash key buffer 252 may be a shiftregister that provides the hash key to hash function unit 253. Hash keybuffer 252 may support multiple hash key sizes ‘N’, e.g., 2 to 6 bytes,including an adaptive key size described in more detail below. Hash keybuffer 252 may prepare multiple hash keys per clock cycle per thread.For example, in a dual thread mode, hash key buffer 252 may beconfigured to prepare up to four hash keys per cycle per thread. Themultiple hash keys may be an overlapping set of N-byte strings.

FIG. 11 is a conceptual diagram illustrating an example of anoverlapping set of 4-byte strings 262A-262D in input data stream 260. Asillustrated in FIG. 11, hash key buffer 252 may prepare a first hash keyat position 0 of input data stream 260 by selecting 4-byte string “ABCD”262A starting with byte position 0. Hash key buffer 252 may prepare asecond hash key at position 1 of input data stream 260 by selecting4-byte string “BCDE” 262B starting with byte position 1. Hash key buffer252 may prepare a third hash key at position 2 of input data stream 260by selecting 4-byte string “CDEF” 262C starting with byte position 2.Hash key buffer 252 may also prepare a fourth hash key at position 3 ofinput data stream 260 by selecting 4-byte string “DEFG” 262D startingwith byte position 3. In this example, each of the four hash keys is 4bytes, which is equivalent to 7 bytes of output with overlapping keys.In other examples, each of the four hash keys may be up to 6 bytes,which is equivalent to 9 bytes of output with overlapping keys.

In accordance with techniques of this disclosure, hash key buffer 252may also support an adaptive key size in which the hash key size may bedifferent at each byte position of the input data stream based onwhether the data starting at the respective byte position is binary ortext. Use of the adaptive key size may reduce a number of hashcollisions for the respective type of data. In general, a larger hashkey size tends to cause fewer hash collisions for text data (i.e., datahaving byte values 0-127) whereas a smaller hash key size tends to causefewer hash collisions for binary data (i.e., data having byte values0-255). As one example, in the adaptive mode, the hash key size may be 4bytes if the data is binary or non-text, and the hash key size may be 5bytes if the data is text.

In order to select the appropriate hash key size for the data, hash keybuffer 252 may determine a most significant bit (MSB) for each of thefirst 4 bytes of the hash key starting at a given byte position. If theMSBs for all of the first 4 bytes are 0, i.e., indicating byte valuesless than or equal to 127, then hash key buffer 252 considers the datato be text and uses a hash key size of 5 bytes. If the MSBs for at leastone of the first 4 bytes is 1, i.e., indicating byte values greater than127, then hash key buffer 252 considers the data to be binary and uses ahash key size of 4 bytes. In the adaptive mode, hash key buffer 252 mayperform this determination at each byte position of the input datastream. The determination may not be stateful such that thedetermination at each byte position is independent and does not dependon the determinations made at previous byte positions in the input datastream.

Returning to FIG. 10, hash function unit 253 of hash controller 223receives the hash key from hash key buffer 252, and applies a hashfunction to the hash key to calculate a hash index into hash table 224.The hash function may be XOR (exclusive or operation) based. Hashfunction unit 253 may receive multiple hash keys per clock cycle perthread from hash key buffer 252, and may calculate multiple hash indicesper clock cycle per thread. For example, in the dual thread mode, hashfunction unit 253 may calculate up to four hash indices for up to fourbyte positions per cycle per thread.

The hash function applied by hash function unit 253 may generate Y bitsof output for the hash key. A first portion of those Y bits may be usedfor the hash index. A second portion of those Y bits may be used togenerate a tag that is stored in hash table 224 and used to detect hashcollisions on a per-entry basis. For example, in the case of a hashcollision in which different hash keys result in the same hash index,the hash collision may be resolved by comparing the tag generated forthe hash key against the tags of the entries (i.e., history addresses)stored in the hash bucket identified by the hash index. The tag bits areunique among colliding hash keys. For example, the hash index for agiven hash key may comprise the lower bits of the output of the hashfunction for the hash key while the tag for the given hash key maycomprise the upper bits of the output of the hash function for the hashkey. The tag may be considered a fingerprint of the hash key. If the tagfor the given hash key does not match the tags of one or more of theentries stored in the hash bucket, then the entries with thenon-matching tags will not be returned as potential matches for thegiven hash key. In this way, the tags may be used to resolve hashcollisions without storing the complete hash key for each byte position.

Bank scheduler 254 of hash controller 223 is configured to scheduleaccesses to hash table 224 using the hash indices calculated by hashfunction unit 253. More specifically, hash datapath 250 uses the hashindex to access a bucket of hash table 224 that includes the most recenthistory addresses of previous occurrences of a same string of bytes asat the current byte position of the input data stream. Bank scheduler254 also sends the current byte position address to hash datapath 250 towrite the current byte position address in the same bucket of hash table224 identified by the hash index to make the current byte stringavailable for future matching.

Bank scheduler 254 may be most useful when processing more than one byteposition per clock cycle due to the potential for bank conflicts, inwhich more than one hash access is attempted in the same memory bank ofhash table 224 in the same clock cycle. Processing more than one byteposition per clock cycle requires more than one hash table access perclock cycle as bank scheduler 254 attempts to read hash table 224 forall of the keys prepared per clock cycle. In one of the examplesdiscussed above, in the dual thread mode, hash table 224 may bepartitioned into two memories, one for each thread, with the memory foreach of the threads being partitioned into 8 banks and with each of thebanks having 2 k hash buckets each holding 4 history addresses. In thisexample, bank scheduler 254 is configured to attempt to schedule up to 4hash accesses per clock cycle per thread.

Bank scheduler 254 attempts to schedule the multiple hash table accessesin the same clock cycle to independent banks of hash table 224, therebyavoiding bank conflicts. For example, bank scheduler 254 may include 8entries and schedule accesses to 8 banks of hash table 224. Bankscheduler 254 may use a portion of the bits of each of the hash indicesto select the one of the hash banks of hash table 224 to which toschedule the access for the given hash index. For a highest throughputmode, hash scheduler 254 may run in a no-stall mode and discard anyentries that do not get scheduled due to hash bank conflicts. For highereffort modes, hash scheduler 254 may take additional clock cycles toretry hash accesses in order to reschedule as many entries as possiblebefore discarding the unscheduled entries.

In some examples, in the case of a hash bank conflict when attempting toread hash table 224 for two or more keys in the same clock cycle,instead of ignoring or discarding unscheduled entries, bank scheduler254 may attempt to reuse the read hash entries for the keys that werenot able to be read due to the hash bank conflict. For example, if afirst key ‘key−x’ and a second key ‘key−(x+y)’ prepared in the sameclock cycle have the same hash index, then the first key may result in aread hash entry while the second key may be unscheduled due to the hashbank conflict. In this example, bank scheduler 254 may assign theposition of the first key as a previous occurrence for the position ofthe second key. This short distance hashing solution may be useful indetecting repeated byte strings (e.g., “aaaaaaaa . . . ”), which wouldtypically result in repeated bank conflicts.

Entries in bank scheduler 254 will have corresponding entries in resultaccumulator 255. Entries in bank scheduler 254 are written in order, buthash table accesses can happen out of order. A given entry in bankscheduler 254 may remain busy until the corresponding entry in resultaccumulator 255 has been cleared, which also happens in order. In thecase where multiple scheduler entries are accessing the same hash index,then only one hash access is required for that group of entries.

Bank scheduler 254 may also insert bubbles in the pipeline toaccommodate history buffer writes, depending on the mode. As a functionof effort level, bank scheduler 254 may insert bubbles into the pipelineto allow history buffer writes to be scheduled without affecting historybuffer reads. At the highest throughput mode (e.g., a multi-threadmode), bubbles may not be inserted for history writes and writes mayinstead be scheduled ahead of reads, as needed.

Hash datapath 250 includes valid entry tracker 257, hash update logic258, and hash table 224. As described above, hash table 224 isconfigurable to support single or dual thread processing and differenthash table sizes depending on an operational mode of hash block 222. Inthe example where hash table 224 has a total storage of 128 k historyaddresses, hash table 224 may be arranged in three differentconfigurations. For a dual thread mode, hash table 224 may comprise twomemories, one for each thread, each configured to include 16 k hashbuckets with each of the hash buckets holding 4 history addresses. For ahigher effort single thread mode, hash table 224 may comprise a singlememory configured to include 8 k hash buckets with each of the hashbuckets holding 16 history addresses. For a highest effort single threadmode, hash table 224 may comprise a single memory configured to include4 k hash buckets with each of the hash buckets holding 32 historyaddresses.

Hash table 224 may need to be initialized at the start of a new inputdata stream to remove any stale data left in hash table 224 and avoidsecurity implications. In one example, hash datapath 250 may use a statemachine to clear hash table 224 at the start of every stream, but thatwould require thousands of clock cycles, e.g., 2 k clock cycles. Inanother example, hash datapath 250 may use valid entry tracker 257,i.e., an auxiliary data structure, to hold the initialization state ofeach word of each row. For example, valid entry tracker 257 may hold 32k bits of initialization state, e.g., 2 k bits per bank for 16 bankswith each bit representing a row in the respective bank. When validentry tracker 27 indicates that a word has not been initialized, hashdatapath 250 may replace the read data with a default value.

FIG. 12 is a conceptual diagram illustrating an example hash table 224in greater detail. As illustrated in FIG. 12, hash table 224 includeshash indices 264A-264Y (collectively, “hash indices 264”) andcorresponding hash buckets 266A-266Y (collectively, “hash buckets 266”).Each of hash buckets 266 includes, for example, four entries where eachof the entries includes a history address 267, a tag (“T”) 268, and avalid bit (“V”) 269. As described above, tag 268 may comprise 4 bits ofthe output of the hash function for a hash key. Tag 268 may beconsidered a fingerprint of the corresponding hash key that can be usedin place of the full hash key to detect hash collisions on a per-entrybasis. For any newly added entry in hash buckets 266, the respectivevalid bit 269 is initially set to indicate the entry as being invalid.Each newly added entry, therefore, must be validated in order to resetthe valid bit 269. As described in more detail below, the tag 267 of therespective entry in hash buckets 266 may be used to qualify valid bit269 for the respective entry.

Each of hash buckets 266 holds the most recent N addresses, four in theexample of FIG. 12, that have that same index. When accessing hash table224, hash update logic 258 of hash datapath 250 performs two operations.First, hash update logic 258 uses a hash index to read a correspondingone of hash buckets 266 of hash table 224 to get a list of historyaddresses that are potential matches for the data at the current byteposition of the input data stream. Second, hash update logic 258 writesthe current byte position to the same one of hash buckets 266 of hashtable 224, dropping the oldest address if the hash bucket is alreadyfull. Hash datapath 250 returns the history addresses read from hashtable 224 during each hash access per cycle per thread to resultsaccumulator 255 of hash controller 223.

As described above, hash collisions, in which different hash keys resultin the same hash index, may be reduced by use of adaptive hashing inwhich the key size is different based on the respective type of data,i.e., text or binary, used to prepare the hash key. When hash collisionsoccur, however, hash update logic 258 may be configured to filter outany invalid history addresses that result from the hash collisions. Forexample, an invalid history address may be a history address that isstored in a hash bucket identified by a hash index determined from agiven hash key, but that points to a previous occurrence of datarepresented by a different hash key that results in the same hash index.

Hash update logic 258 may compare tag bits generated for the given hashkey against tag 268 for each history address 267 stored in the hashbucket identified by the hash index. If the tag bits for the given hashkey do not match tag 268 of the history address 267, then hash updatelogic 258 determines that the history address is invalid. Hash updatelogic 258 may then not return that history address as a potentialprevious occurrence of the byte string represented by the given hashkey. Hash update logic 258 may make this determination on a per-entrybasis within the hash bucket identified by the hash index. In this way,hash update logic 258 may return more accurate history addresses for thegiven hash key regardless of the occurrence of hash collisions.Regardless of whether the tag bits match, hash update logic 258 writesthe current byte position as the newest history address 267 in the samehash bucket and also writes the corresponding key bits for the givenhash key as the key 268 of the history address 267. The newly addedentry in the hash bucket is then validated in order to reset the validbit 269 to indicate that the new entry is valid to enable subsequenthash collision processing.

Returning to FIG. 10, results accumulator 255 of hash controller 223receives the history addresses from hash datapath 250 and, in turn,sends the history addresses of the previous occurrences to the matchblock 228. Result accumulator 255 holds the output of the hash tablereads (i.e., the history addresses) until it is time to send the historyaddresses to match block 228. Results accumulator 255 may reorder theresults when processing multiple byte positions per cycle per thread. Insome examples, results accumulator 255 may send up to 16 historyaddresses per cycle per thread to match block 228. Results accumulator255 also sends each of the byte position addresses processed per cycleto match block 228.

FIG. 13 is a block diagram illustrating an example architecture of matchblock 228 of search block 206 from FIG. 7B. In the illustrated example,match controller 229 of match block 228 includes a bank scheduler 272and a post processor 273. Match datapath 270 of match block 228 includeshistory buffer 230 having a large history buffer 276 and a small historybuffer 278, along with a lookahead buffer 274 and byte compare logic275. The architecture of match block 228 illustrated in FIG. 13 is shownfor exemplary purposes only. In other examples, match block 228 may beconfigured in a variety of ways.

Match block 228 is configurable to operate in different modes dependingon the level of compression or effort desired for the input data stream.History buffer 230 is also configurable to support single ormulti-thread processing with different memory bank arrangements in largehistory buffer 276 and small history buffer 278 depending on anoperational mode of match block 228. For example, history buffer 230 maysupport large history buffer 276 having a size of up to 256 KB, and asmall history buffer 278 having a size of up to 32 KB. Across both largehistory buffer 276 and small history buffer 278, history buffer 230 mayinclude 16 banks with independent read ports each supporting 16 byteunaligned accesses or 32 byte aligned accesses.

FIGS. 14A and 14B are conceptual diagrams illustrating different exampleconfigurations of large history buffer 276 and small history buffer 278for a dual thread mode and a single thread mode, respectively. In otherexamples, large history buffer 276 and small history buffer 278 may bearranged in additional or different configurations.

For the dual thread mode, FIG. 14A illustrates an example history bufferconfiguration per thread. As one example, for the dual thread mode, amaximum history size may be 32 KB. In that example, a large historybuffer 276A is configured to include a set of 4 large memory banks, eachcontaining the full 32 KB history, per thread. In addition, a smallhistory buffer 278A is configured to include a set of 4 small memorybanks, each containing 4 KB for a total of 16 KB, per thread. The 16 KBincluded in small history buffer 278A may be the most recent 16 KB ofthe full history included in each of the large memory banks of largememory buffer 276A. The most recent history may be spread across thesmall memory banks in the set of small memory banks per thread usingmemory striping to spread access evenly across the banks. For example,the 16 KB may be spread across the 4 small memory banks using a 256 bytestripe size.

For the single thread mode, FIG. 14B illustrates an example historybuffer configuration. As one example, for the single thread mode, amaximum history size may be 256 KB. In that example, a large historybuffer 276B is configured to include a set of 8 large memory banks eachcontaining 32 KB for a total of 256 KB. The full history may be spreadacross the large memory banks of large history buffer 276B using memorystriping to spread access evenly across the banks. In addition, a smallhistory buffer 278B is configured to include a set of 8 small memorybanks each containing 4 KB for a total of 32 KB. The 32 KB included insmall history buffer 278B may be the most recent 32 KB of the fullhistory included in large memory buffer 276B. The most recent historymay be spread across the small memory banks of small history buffer 278Busing memory striping to spread access evenly across the banks. Forexample, all banks in both large history buffer 276B and small historybuffer may use a 256 byte stripe size.

FIG. 15 is a conceptual diagram illustrating an example of striping dataacross multiple memory banks of a history buffer. Data striping, asdescribed herein, may be used in scenarios where the memory banks of thehistory buffer are smaller than the allowed history size for a specificcompression algorithm and where the history buffer accesses tend to beclose together. According to the disclosed techniques, the entirehistory may be stored in the smaller memory banks by striping thehistory data across the memory banks. Since most of the previousoccurrence matches are close to the current byte position, the datastriping increases the available history size of the smaller memorybanks while reducing bank conflicts when attempting to access thehistory to perform match checking for two or more addresses in the samecycle. This configuration may be desirable as it makes more usefulhistory data that is closer to the current byte position available tomatch block 228 without dropping potential matches at longer distancesfrom the current byte position.

In the example of FIG. 15, the full history of 256 KB for the singlethread mode is spread across 8 memory banks of large history buffer 276Bof FIG. 14B using a 256-byte stripe size. In other examples, a similardata striping technique may be applied to differently configuredmemories using different stripe sizes. For example, similar datastriping techniques may be applied to small history buffer 278A of FIG.14A or 278B of FIG. 14B to spread the small history across the smallmemory banks in either the dual thread mode or the single thread mode,respectively.

A single memory may be partitioned into multiple banks to enablemultiple accesses to the single memory in the same clock cycle, e.g.,one access per bank per cycle. Conventionally, each of the banks mayhold a contiguous portion of the memory. For example, in the case of a256 KB memory, each of 8 banks may hold a contiguous 32 KB of data. Thismay work well in scenarios where the multiple accesses per cycle areevenly distributed across the single memory such that the probability ofbank conflicts is low. In the case of history-based compression asdescribed in this disclosure, the history addresses for the potentialmatches for a current byte position are likely to be close to each otherwithin the history buffer. In this scenario, the multiple accessesattempted per cycle are likely to hit within the same memory bank of aconventionally partitioned history.

In accordance with the described techniques, instead of partitioning ahistory buffer into multiple banks of contiguous data, the historybuffer is partitioned into multiple banks and the data is striped acrossthe multiple banks. In this way, each of the memory banks includes aplurality of non-contiguous stripes or bands with each of the stripesholding a fixed amount of contiguous data. As illustrated in FIG. 15,large history buffer 276B is partitioned into 8 large memory banks(Banks 1-8). Starting at Bank 1, the history data is stored inconsecutive stripes of a relatively small fixed length, e.g., 256 bytes,in each of the memory banks up to Bank 8. Once the eighth stripe of datais stored in Bank 8, the process returns to Bank 1 to store the nextconsecutive data stripe. More specifically, as shown in FIG. 15, Bank 1includes data stripe of bytes 0 to 255, Bank 2 includes data stripe ofbytes 256 to 511, Bank 3 includes data stripe of bytes 512 to 767, Bank4 includes data stripe of bytes 768 to 1023, Bank 5 includes data stripeof bytes 1024 to 1279, Bank 6 includes data stripe of bytes 1280 to1535, Bank 7 includes data stripe of bytes 1536 to 1791, and Bank 8includes data stripe of bytes 1792 to 2047 followed by returning to Bank1 for data stripe of bytes 2048 to 2303. The striping of data into eachmemory bank continues until the full history, e.g., 256 KB, is stored inhistory buffer 276B. For example, the last data stripe in Bank 8 is forbytes 255,744 to 255,999.

Striping the history data across multiple banks of the history buffer,as described above, may help to distribute the attempted accesses perclock cycle to the different memory banks of the history buffer. Even inthe case where addresses of the attempted accesses tend to be close toeach other within the history buffer, the relatively small stripe sizecompared to the full size of each of the memory banks may effectivelyspread out the attempted accesses to hit within different memory banks.In this way, the striping technique may avoid bank conflicts and ensurea higher number of history buffer accesses per clock cycle.

Returning to FIG. 13, bank scheduler 272 of match controller 229 isconfigured to schedule accesses to history buffer 230 in match datapath270 using the history addresses received from hash block 222. Bytecompare logic 275 of match datapath 270 uses the history addresses toread a byte string of previously processed data from history buffer 230,and then compares the retrieved byte string of the previously processeddata to a byte string starting from the current byte position address inthe input data stream to determine potential matches. As described abovewith respect to FIG. 9, the input data stream is written to lookaheadbuffer 274 of match datapath 270 by receiver block 220 of search block206. Bank scheduler 272 may compute a lookahead address in lookaheadbuffer 274 based on the current byte position address received from hashblock 222 to be used by byte compare logic 275 for the comparisons tothe potential matches in history buffer 230.

Bank scheduler 272 may operate in different modes depending on the levelof compression or effort desired for the input data stream. For ahighest throughput mode, bank scheduler 272 attempts to schedule as manyaccesses to history buffer 230 as possible in one clock cycle. Forexample, in the dual thread mode, large history buffer 276 and smallhistory buffer 278 may be configured as shown in FIG. 14A to include 8memory banks per thread. In this example, bank scheduler 272 may receiveup to 16 history addresses from hash block 222 per cycle per thread, andschedule as many accesses as possible to the 8 banks of history buffer230 per cycle per thread. Any scheduling entries for the historyaddresses that cannot be scheduled during the single clock cycle, e.g.,due to bank conflicts, may be discarded.

Continuing the example in the dual thread mode, if the distances betweenthe current byte position and the received history addresses are lessthan or equal to 16 KB such that the history addresses are within themost recent 16 KB of the full history included small history buffer 278Afrom FIG. 14A, then bank scheduler 272 may schedule up to 8 accesses perthread across the 8 banks of large history buffer 276A and small historybuffer 278A. On the other hand, if the distances between the currentbyte position and the received history addresses are greater than 16 KBsuch that the history addresses are not included in small history buffer278A, then bank scheduler 272 may only schedule up to 4 accesses perthread to across the 4 banks of large memory buffer 276A. In this way,since most of the previous occurrence matches are close to the currentbyte position, bank scheduler 272 is able to schedule accesses to morememory banks for those history addresses that are closer to the currentbyte position.

For higher effort modes, bank scheduler 272 attempts to schedule as manyaccesses to history buffer 230 as possible over a fixed number of clockcycles, e.g., 1 or 2 or 4 clock cycles. For example, in the singlethread mode, large history buffer 276 and small history buffer 278 maybe configured as shown in FIG. 14B to include 16 memory banks. In thisexample, bank scheduler 272 may receive up to 16 history addresses fromhash block 222 per cycle, and schedule as many accesses as possible tothe 16 banks of history buffer 230 over the fixed number of cycles. Anyscheduling entries for the history addresses that cannot be scheduledduring the fixed number of clock cycles, e.g., due to bank conflicts,may be discarded.

Continuing the example in the single thread mode, if the distancesbetween the current byte position and the received history addresses areless than or equal to 32 KB such that the history addresses are withinthe most recent 32 KB of the full history included small history buffer278B from FIG. 14B, then bank scheduler 272 may schedule up to 16accesses per thread across the 16 banks of large history buffer 276B andsmall history buffer 278B. On the other hand, if the distances betweenthe current byte position and the received history addresses are greaterthan 32 KB such that the history addresses are not included in smallhistory buffer 278B, then bank scheduler 272 may only schedule up to 8accesses per thread to across the 8 banks of large memory buffer 276B.In this way, since most of the previous occurrence matches are close tothe current byte position, bank scheduler 272 is able to scheduleaccesses to more memory banks for those history addresses that arecloser to the current byte position.

Bank scheduler 272 is also configured to schedule writes of the bytestrings at the current byte position addresses of the input data streamto history buffer 230 in match datapath 270. In this way, match block228 may continually add the most recent data from the input data streamto the self-referential history. The writes may be scheduled fromlookahead buffer 274 to history buffer 230. Lookahead buffer 274 may bea 128-byte buffer configured to hold the input data stream. Lookaheadbuffer 274 may also function as a write buffer with support ofwrite-to-read bypass. Once a given chunk of write data has accumulatedin lookahead buffer 274, e.g., 32-bytes, and the current byte positionin the input data stream has moved passed that data chunk, bankscheduler 272 may schedule a write of that data from lookahead buffer274 to history buffer 230. For the highest throughput mode, bankscheduler 272 may track when a write is needed and schedule the write athigher priority than a read. For higher effort modes, hash block 222 mayschedule a bubble for every chunk, e.g., 32-bytes, of data processed sothat match block 228 has time to schedule the write to the historybuffer 230 without interfering with reads. Hash block 222 may onlyexplicitly insert bubbles if it detects the chunk of data processedwithout any other source of bubble.

FIG. 16 is a conceptual diagram illustrating an example of matchdatapath 270 in more detail. As illustrated, match datapath 270 includeshistory buffer 230, lookahead buffer 274, and byte compare logic 275.Although match datapath 270 is illustrated in FIG. 16 as including onlya single instance of each the components, in other examples, matchdatapath 270 may include multiple instances of each of the historybuffer, lookahead buffer, and byte compare logic. For example, matchdatapath 270 may comprise a total of two banks consisting of twosub-banks or four memory instances. In one example, history buffer 230may include two sub-banks that are each 16-bytes wide to support up to16 byte unaligned reads or 32 byte aligned reads. Even when a read isnot aligned, any data read from history buffer 230 may be used formatching by byte compare logic 275.

As described above, lookahead buffer 274 holds the input data stream andoperates as a history write buffer. In the example of having four memoryinstances, lookahead buffer 274 may include one aligned read port andone unaligned read port per sub-bank, so a total of four aligned readports and four unaligned read ports. As one example, all of the readports may be 16 bytes wide. The aligned read port of lookahead buffer274 may be used to send write data to history buffer 230, and in somecases, may be used to bypass write data to the read path of historybuffer 230. The unaligned read port of lookahead buffer 274 may be usedfor lookahead buffer reads. The unaligned read allows the lookaheadbuffer read to match the alignment of the history buffer read, so that abyte level comparison can be performed by byte compare logic 275.

Byte compare logic 275 compares the data in lookahead buffer 274 to thedata in history buffer 230 to find a matching sequence of bytes. Morespecifically, byte compare logic 275 is configured to compare a bytestring on byte-by-byte basis starting from a current byte position ofthe input data stream stored within lookahead buffer 274 with thepotential byte string matches in the previously processed data storedwithin history buffer 230 at the history addresses received from hashblock 222. Byte compare logic 275 creates a list of matches, i.e., amatch vector, between the current data stream and history buffer 230. Inthe example of having four memory instances, byte compare logic 275 mayalso have four instances with one instance per sub-bank. As one example,one instance of byte compare logic 275 may be configured to compare 16bytes of data and generate a 16-bit match vector. The match vector issent back to match controller 229 for the match length to be counted bypost processor 273 of match controller 229.

Returning to FIG. 13, as part of the match checking process, match block228 may be configured to perform backward matching. Backward matchingmay be used to determine whether one or more bytes immediately precedinga current byte position in the input data stream also match the datawithin history buffer 230. In some example, a potential match beginningat one of the preceding byte positions may have been missed due to abank conflict or hash collision at hash block 222. The result ofbackward matching may be identification of a longer history match for abyte string in the input data stream and, hence, higher compression ofthe input data stream.

FIG. 17 is a conceptual diagram illustrating an example of backwardmatching performed by match block 228 of FIG. 13. For backward matching,bank scheduler 272 of match controller 229 may modify a history addressreceived from hash block 222. As one example, bank scheduler 272 may beconfigured to modify each of the received history addresses to supportmatching up to 4 bytes preceding the byte position pointed to by theoriginal history address. In other words, bank scheduler 272 maysubtract up to 4 bytes from the original history address prior toscheduling the access to history buffer 230. In some cases, if thismodification causes the address to cross into a different memory bank ofhistory buffer 230, then the original history address may be usedinstead.

In the illustrated example of FIG. 17, the current byte position 290 ofthe input data stream is position 104 (the second instance of the letter“D”) and the original history address 291 received from hash block 222for the current byte position is position 4 (the first instance of theletter “D”). As shown, starting from both position 4 and position 104,the byte strings include the English alphabet from letter “D” to letter“Z” and are followed by non-matching bytes (i.e., the number “1” atposition 27 and the number “0” at position 127, respectively). Bytecompare logic 275, therefore, identifies a match between current byteposition 290 and original history address 291 including subsequent bytepositions having a length of 23 bytes in the forward direction of theinput data stream.

As can be seen in the example of FIG. 17, the full match between thecurrent byte string and the previous byte string actually begins threepositions earlier in the input data stream. This match beginning at oneof the preceding byte positions may have been missed due to one or moreunscheduled or unsuccessful hash reads due to bank conflicts or hashcollisions at hash block 222. In order to find this earlier match and,thus, generate a longer match for the current data, bank scheduler 272may modify the original history address 291 received from hash block 222by subtracting up to 4 positions from the original history address(e.g., from byte position 4 to byte position 0). Byte compare logic 275may then perform the byte-by-byte comparison in the backward directionup to the modified history address at byte position 0 to identify anyadditional matches. As shown in FIG. 17, byte compare logic 275identifies an additional match between current byte position 290 andoriginal history address 291 including preceding byte positions having alength of 3 bytes in the backward direction of the input data stream. Inthe example of FIG. 17, this backward match is followed by non-matchingbytes (i.e., the number “3” at position 0 (i.e., the modified historyaddress) and the number “4” at position 100, respectively. In theexample illustrated in FIG. 17, byte compare logic 275 may pass the23-byte length forward match and the 3-byte length backward matchdetermined for the current byte string at the current byte position 290back to match controller 229 in the match vector.

Returning to FIG. 13, post processor 273 is configured to process thematch vector from match datapath 270 and send the results to path block232. Post processor 273 determines a match length for each of thematches included in the match vector. More specifically, post processor273 counts the number of matching bytes for each history buffer access.The count starts at the current byte position and goes forward as manybytes as possible for the forward matches. For example, for each of thematches, match controller 229 may count until detecting a “match byte”as a first non-matching byte after a match or a “previous byte” as thelast byte that gets matched. Post processor 273 may similarly countbackwards from the current byte position for the backward matches. Postprocessor 273 sends the forward and backward match lengths for each ofthe matches to path block 232.

In some examples, the match lengths may be included in an indicationsent from match block 228 to path block 232 of whether at least onematch occurs for the current byte string. The indication may include theliteral of original data at the current byte position, e.g., the literal“D” at current byte position 290 in the example of FIG. 17, and a numberof matches, e.g., at least 1 in the example FIG. 17. For each of thematches, the indication may include a length of any forward match, e.g.,23-bytes in the example of FIG. 17, and a length of any backward match,e.g., 3-bytes in the example of FIG. 17, for the current byte string. Inthe case where no match occurs for the current byte sting, theindication may include the literal of original data at the current byteposition with number of matches set equal to zero.

FIG. 18 is a block diagram illustrating an example architecture of pathblock 232 of search block 206 from FIG. 7B. In the illustrated example,path block 232 includes a pick block 300 and a lazy block 302. Thearchitecture of path block 232 illustrated in FIG. 18 is shown forexemplary purposes only. In other examples, path block 232 may beconfigured in a variety of ways.

Path block 232 is configured to pick the best match (i.e., longest andclosest, in that order) for each byte position of the input data streambased on the match lengths received from match block 228. Path block 232may perform three main functions: find the best match at each byteposition, select the best match within a lazy evaluation window, and/orapply post processing to merge consecutive matches to form a longermatch.

Pick block 300 of path block 232 is configured to select the best matchat each byte position in the input data stream, but lazy block 302 maybe configured to make the final decision of whether that best matchshould be used for the current byte position. As one example, theselection process performed by pick block 300 may first identify thelongest match for the current byte position, and, if there is a tieamong two or more matches, pick block 300 may select the match havingthe smallest distance from the current byte position as the best match.

Pick block 300 may consider the following sources of potential matches:forward matches from the current byte position, backward matches fromsubsequent byte positions, and carry forward matches from previous bytepositions. In the case of backward matches, match block 228 may performbackward matching, as described above with respect to FIG. 17, at eachof the subsequent byte positions to explicitly look for matches at up to4 bytes preceding each of the subsequent byte positions, i.e., includingthe current byte position. Pick block 300 may then consider the matchlengths applied at the current byte position by any backward matchesfrom the subsequent byte positions when selecting the best match for thecurrent byte position. In this way, pick block 300 may allow up to 8byte positions to be processed in parallel per thread, including the upto 4 byte positions per cycle per thread searched by hash block 222 andmatch block 228, and the previous 4 byte positions backward matched bymatch block 228.

FIG. 19 a conceptual diagram illustrating an example of carry forwardmatching performed by path block 232 of FIG. 18. In the case of carryforward matches, pick block 300 of path block 232 may be configured toidentify any matches from previous byte positions in the input datastream that overlap a current byte position, and determine truncatedlengths of the matches at the current byte position. Pick block 300 maythen consider the truncated match lengths applied at the current byteposition by any matches from the previous byte positions when selectingthe best match for the current byte position. For example, pick block300 may look at a match of length 7 at a previous byte position that istruncated to a match of length 6 at the current byte position toidentify the best match for the current byte position. Pick block 300may look at the same match at a subsequent byte position that istruncated to a match of length of 5, and so on.

In the illustrated example of FIG. 19, a match occurs between a bytestring beginning at previous byte position 306 (the second instance ofletter “A” at position 100) and a previous occurrence of the byte stringbeginning at history address 308 (the first instance of letter “A” atbyte position 0) having a length of 16 bytes in the forward direction ofthe input data stream. As shown, starting from both position 0 andposition 100, the byte strings include the English alphabet from letter“A” to letter “P” and are followed by non-matching bytes (i.e., thenumber “3” at position 16 and the number “4” at position 116,respectively).

As can be seen in the example of FIG. 19, the match beginning atprevious byte position 306 overlaps a current byte position 310 of theinput data stream such that at least a portion of the match may beapplied at the current byte position. In this case, pick block 310determines a truncated length of the match at the current byte positionto be equal to the initial length of the match beginning at previousbyte position 306 less the position difference between current byteposition 310 and the previous byte position 306. In the example of FIG.19, the difference between current byte position 310 (i.e., position102) and previous byte position 306 (i.e., position 100) is 2, and pickblock 310 determines the truncated length of the match at current byteposition 310 to be equal to 14 bytes (i.e., 16-2). In this way, pickblock 310 may identify additional matches from previous byte positionsapplied at current byte position 310 and consider the match lengths ofthe additional matches when selecting the best match for the currentbyte position.

Returning to FIG. 18, in order to select the best match at the currentbyte position from among the forward matches, backward matches, andcarry forward matches, pick block 300 may perform the following steps.First, at the current byte position “P,” pick block 300 takes thebackward matches received from match block 228 and attempts to extendmatch lengths at previous byte positions in the input data stream, i.e.,byte positions (P−1), (P−2), and so on up to (P−4), based on the lengthsof the backward matches. Second, pick block 300 determines a best match(i.e., longest and closest) from among the previous byte positions, andperforms carry forward matching by applying the best match to thecurrent byte position with a truncated match length. For example, ifbyte position (P−2) has a match length of 100 and is the best match fromamong byte positions (P−4) to (P−1), pick block 300 applies the match atbyte position (P−2) to the current byte position P with a truncatedmatch length of 98 (i.e., 100-2). Third, pick block 300 compares thetruncated match length at the current byte position to lengths offorward matches from the current byte position to determine a longestmatch for the current byte position. As described above, if there is atie for length among two or more matches, pick block 300 may select thematch having the smallest distance from the current byte position as thebest match.

Lazy block 302 of path block 232 is then configured to determine whetherto emit a literal or a match, or nothing if a match is emitted at aprevious position, for each byte position in the input data stream. Lazyblock 302 may perform either a greedy match or a lazy match within alazy window. For the greedy method, lazy block 302 uses the best matchthat is detected by pick block 300 for the current byte position. Lazyblock 302 may select the output for the current byte position based onthe best match from among all the matches received for the current byteposition from match block 228 based on the history addresses identifiedby hash block 222. For a highest throughput mode, lazy block 302 mayselect the output based on the best match from among the 4 historyaddresses searched for the current byte position. For higher effortmodes, lazy block 302 may select the output based on the best match fromamong the 8 or 16 history addresses searched for the current byteposition.

For the lazy method, lazy block 302 looks at the next N byte positionswithin a lazy window and selects the output for the current byteposition based on the best match across all of the positions within thelazy window. For example, if the best match at the current byte positionis not the best match based on all of the byte positions within the lazywindow, lazy block 302 may discard the best match at the current byteposition and instead emit a literal of the original data at the currentbyte position. If any of the other byte positions within the lazy windowaffect the current byte position, lazy block 302 may update (e.g., mergeor extend) the match lengths at the current byte position. After thematch lengths are updated, lazy block 302 may determine the best matchfor the current byte position based on the current lazy window. The lazywindow may then advance by 1 to the next byte position in the input datastream, and lazy block 302 may make the same determination within thenew lazy window.

The lazy window may be configurable with size N set equal to an integervalue between 0 and 2, where 0 is used to indicate the greedy method.For a lazy window of size 2, lazy block 302 may select the output forthe current byte position based on the best match from among all thematches determined for the current byte position within the moving lazywindow. For a highest throughput mode, lazy block 302 may select theoutput based on the best match from among 12 history addresses searchedfor the 3 positions within the lazy window. For higher effort modes,lazy block 302 may select the output based on the best match from amongthe 24 or 48 history addresses searched for the 3 positions within thelazy window.

In order to select the output for the current byte position after thethree steps, described above, performed by pick block 200 to select thebest match at the current byte position, lazy block 302 may perform thefollowing steps. Fourth, lazy block 302 may determine the best matchwithin the lazy window. If the best match at the current byte positionis a best match among the byte positions within the lazy window, lazyblock 302 emits a length-distance pair as a reference to the best matchat the current byte position. The length-distance pair identifying thematch for the current byte string includes a length set equal to alength of the repeated byte string beginning at the current byteposition in the input data stream and a distance set equal to thedistance from the current byte position to a history address of theprevious occurrence of the byte string in history buffer 230. If thebest match at the current byte position is not the best match among thebyte positions within the window, lazy block 302 emits a literal of theoriginal data at the current byte position.

Fifth, when a match is selected for the current byte position based onthe current lazy window, lazy block 302 may hold the match instead ofimmediately outputting the match to transmitter block 234. Lazy block302 may use the held matches to determine which byte positions in theinput data stream have already been covered by a previous match suchthat nothing needs to be emitted for those byte positions. Lazy block302 may also use the held matches to identify and merge consecutivematches to form longer matches. For example, when a match initiallyselected as output for the current byte position reaches a maximum matchlength without detecting an end of the initial match, lazy block 302 maydetermine whether matches at any subsequent byte positions within themoving lazy window extend the length of the initial match. As oneexample, lazy block 302 may determine whether an additional match occursbeginning one byte subsequent to the maximum match length of the initialmatch and having a same relative distance as the initial match.

If any of the matches extend the length of the initial match, i.e., ifany of the matches at the subsequent byte positions have the samedistance but extend further than the initial match, lazy block 302 maymerge the matches to extend the maximum match length of the initialmatch beginning at the current byte position. Lazy block 302 may thenselect a length-distance pair identifying the initial match having theextended match length as output for the current byte position.

In some examples, the maximum match length may be 16 bytes or 32 bytesdepending on the bank sizes in history buffer 230 of match block 228.Lazy block 302 may determine that the initial match reaches the maximummatch length without detecting the end of the initial match based on theinitial match having a length equal to the maximum match length withoutindicating either a “match byte” as a first non-matching byte after theinitial match or a “previous byte” as a last byte of the initial match.

Once the output is selected for the byte positions being processed, lazyblock 302 sends up to 4 literals and/or length-distance pairs per clockcycle per thread to transmitter block 234 for output from search block206. For each output match, lazy block 302 may append the “match byte”as the first non-matching byte after the match or the “previous byte” asthe last byte that gets matched. This information may be used by REDblock 208 to generate context for encoding the next byte using LZMAcompression.

FIG. 20 is a block diagram illustrating an example architecture oftransmitter block 234 of search block 206 from FIG. 7B. In theillustrated example, transmitter block 234 includes a pack unit 320, achecksum unit 322, and an output buffer 324.

Pack unit 320 is configured to pack the raw output received from pathblock 232 into a space efficient output data stream. Pack unit 320 packsthe raw literals or length-distance pairs from path block 232 into abyte aligned format before sending to CP 202 via output buffer 324. Inone example, the byte aligned format of the packed data stream consistsof 9 byte chunks, each with 1 byte of header data and 8 bytes ofhistory-compressed data. In some examples, literals may consume 1 byteof data, and length-distance pairs may consume 2 bytes to 4 bytes ofdata. The packed data stream is then stored in output buffer 324 fortransmission to CP 202. From CP 202, the data stream may be sent on toan external memory, RED block 208, or Huffman block 210.

FIGS. 21A-21B are conceptual diagrams illustrating an example of a bytealigned format for packing raw literals or length-distance pairs intothe output data stream output from transmitter block 234 of FIG. 20.FIG. 21A illustrates an example format of an output data stream 330 thatincludes a header 332 and a payload 334. Header 332 comprises 1 byte or8 bits of header data and payload 334 includes 8 bytes or 64 bits ofhistory-compressed data as literals and/or length-distance pairs. Eachof the 8 bits of header data within header 332 describes one of the 8bytes of history-compressed data within payload 334. In this way, outputdata stream 330 fits on a 72 bit bus between search block 206 and REDblock 208 or Huffman block 210.

FIG. 21B illustrates an example tree structure 336 for header dataincluded within header 332 of output data stream 330. As describedabove, each of the 8 bits of header data within header 332 describes oneof the 8 bytes of history-compressed data within payload 334. Morespecifically, each of the 8 bits of header data indicates whether aliteral or a length-distance pair is held at a given byte within payload334.

According to the tree structure 336 illustrated in FIG. 21B, pack unit302 sets the first bit of header data within header 332 equal to “1” toindicate that the first byte within payload 334 holds a literal.Alternatively, pack unit 302 sets the first bit of header data withinheader 332 equal to “0” to indicate that the first byte within payload334 holds a length-distance pair. Pack unit 302 then follows treestructure 336 until it sets a subsequent bit of header data in header332 equal to “1” to indicate a specific type of length-distance pair,e.g., LDP Type_0 through LDP Type_6, held by the corresponding bytes ofhistory-compressed data within payload 334. The type of length-distancepair may be based on the length and the distance of the match to beoutput for the first byte position. Longer matches and/or largerdistances from the current byte position in the input data streamtypically consume more bytes within payload 334 and, thus, are indicatedby a longer bit string within header 332.

As one example, according to the tree structure 336, the bit string “01”within header 332 indicates that the corresponding bytes within payload334 hold a length-distance pair of LDP Type_0, which uses bits [15:0]within payload 334 with bits [15:12] defined for length and bits [11:0]defined for distance. As another example, according to the treestructure 336, the bit string “001” within header 332 indicates that thecorresponding bytes within payload 334 hold a length-distance pair ofLDP Type_1, which uses bits [23:0] within payload 334 with bits [23:15]defined for length and bits [14:0] defined for distance. The types oflength-distance pairs for each of LDP Type_2 through LDP Type_6 may besimilarly defined.

Once pack unit 302 sets a bit of header data within header 332 equal to“1,” in order to indicate either a literal or a specific type oflength-distance pair for the corresponding bytes within payload 334,pack unit 302 then returns to the top of tree structure 336 to determinethe next bit or bit string for inclusion in header 332 for the nextbytes within payload 302. For example, a bit string of “11111111” withinheader 332 indicates that each of the 8 bytes of data within payload 334comprises a literal. As another example, a bit string of “10010101”within header 332 indicates that the 8 bytes of data within payload 334comprise a literal, a length-distance pair of LDP Type_1, a firstlength-distance pair of LDP Type_0, and a second length-distance pair ofLDP Type_0.

Returning to FIG. 20, checksum unit 322 is configured to compute achecksum, e.g., either CRC32 or Adler32, on the uncompressed data of theinput data stream to detect errors that may have been introduced duringprocessing and storage in the pipeline of search block 206. The checksummay be sent out during a final cycle of processing the input data streamwhen an end-of-stream is asserted along with other information, such asany determined error codes. The checksum may be preloaded to handle datafiles that are split across multiple packets. In this way, checksum unit322 may resume checksum computation for partially processed input.

Output buffer 324 receives the packed data stream of the historycompressed output from pack unit 320. Output buffer 324 may comprise aFIFO (first in, first out) buffer sized to hold data in flight in thepipeline of search block 206. Output buffer 324 is configured to handleflow control with receiver block 220 for the pipeline of search block206. Output buffer 324 uses credit-based flow control by returningcredits to receiver block 220 based on the amount of space available tostore data in output buffer 324. Output buffer 324 is also configured torespond to flow control from CP 202 for the egress interface to avoidtransmitting more data than the egress interface can handle. Outputbuffer 324 uses credit-based flow control based on credits received fromCP 202 based on the amount of bandwidth available for the egressinterface.

FIG. 22 is a flowchart illustrating an example history-based datacompression operation performed in accordance with the techniques ofthis disclosure. The operation illustrated in FIG. 22 may be performedby, e.g., the components of search block 206 from FIGS. 7A and 7B, orother devices in other examples. Furthermore, the operation of FIG. 22may be performed in a different order or with fewer operations than whatis shown in FIG. 22. As illustrated in FIG. 7B, search block 206 isimplemented as a pipeline for performing history-based compression on aninput data stream. More specifically, search block 206 replaces a stringof bytes in the input data stream with a previous occurrence of the samestring of bytes to achieve compression.

Search block 206 receives an input data stream to be compressed (350).Hash block 222 of search block 206 identifies one or more historyaddresses of potential previous occurrences of a current byte stringbeginning at a current byte position in the input data stream (352).More specifically, hash block 222 is configured to prepare a ‘key’ ateach input byte position by selecting ‘N’ number of bytes starting withthe input byte at the respective position and use the key to calculate ahash index into hash table 224. Hash block 222 uses the hash index toaccess a bucket of hash table 224 that contains history addresses of anyprevious occurrences of the same string of bytes in the input datastream. Hash block 222 then sends the history addresses of the previousoccurrences to match block 228 and records the current byte positionaddress into the same bucket in hash table 224.

Match block 228 of search block 206 determines whether at least onematch occurs for the current byte string from among one or more previousoccurrences of byte strings at the history addresses (354). Morespecifically, match block 228 is configured to match the string of bytesat the current position with the string of bytes at the previousoccurrences identified by the history addresses in history buffer 230,and send the matches to path block 232.

Path block 232 of search block 206 selects an output for the currentbyte position, wherein the output for the current byte positioncomprises one of a reference to a match for the current byte string or aliteral of original data at the current byte position (356). Morespecifically, path block 232 is configured to pick the best match ateach position (i.e., longest and closest, in that order) and send thebest match as compressed output of search block 206. Search block 206then transmits the selected output for the current byte position in anoutput data stream (358).

FIG. 23 is a flowchart illustrating an example hashing operation forhistory-based data compression performed in accordance with thetechniques of this disclosure. The operation illustrated in FIG. 23 maybe performed by, e.g., the components of hash block 222 from FIG. 10, orother devices in other examples. Furthermore, the operation of FIG. 23may be performed in a different order or with fewer operations than whatis shown in FIG. 23.

Hash block 222 generates a hash key from a current byte string beginningat a current byte position in an input data stream to be compressed(360). Hash block 222 computes a hash index from the hash key using ahash function (362) and accesses a hash bucket of hash table 224identified by the hash index (364). In some examples, hash block 222 isconfigured to index a set of M keys generated using N-byte strings at Mbyte positions into hash table 224 in parallel during a single clockcycle by dividing hash table 224 into banks and accessing the banks inparallel. In this way, hash block 222 will process up to M bytepositions per clock cycle. Hash block 222 may be configured to avoidhash collisions by performing adaptive hashing in which the key size isdifferent for non-text or binary data than for text data. Hash block 222may be further configured to resolve hash collisions by generating a tagfor each key and then comparing the tag for the respective key againstthe tags of the entries stored in the hash bucket, where the tag bitsare unique among colliding keys.

During the hash table access, hash block 222 reads one or more historyaddresses of potential previous occurrences of the current byte stringin the input data stream from the hash bucket identified by the hashindex, wherein the history addresses comprise byte positions of previousoccurrences of byte strings (366). In the case of a bank conflict whenattempting to read hash table 224 for two or more keys in the samecycle, hash block 222 may assign a first key position as a previousoccurrence for a second key position. Hash block 222 then sends the oneor more history addresses read from hash table 224 to a subsequent blockin the pipeline of search block 206, e.g. match block 228, for use incompressing the input data stream (368).

FIG. 24 is a flowchart illustrating an example matching operation forhistory-based data compression performed in accordance with thetechniques of this disclosure. The operation illustrated in FIG. 24 maybe performed by, e.g., the components of match block 228 from FIG. 13,or other devices in other examples. Furthermore, the operation of FIG.24 may be performed in a different order or with fewer operations thanwhat is shown in FIG. 24.

Match block 228 receives one or more history addresses of potentialprevious occurrences of a current byte string beginning at a currentbyte position in an input data stream (370). Match block 228 determineswhether at least one forward match occurs between the current byteposition of the current byte string and the history addresses of one ormore previous occurrences of byte strings, the forward match includingsubsequent byte positions in a forward direction of the input datastream, wherein the history addresses comprise byte positions of theprevious occurrences of byte strings stored in history buffer 230 (372).Match block 228 is configured to determine whether string matches haveoccurred beginning at each byte position in a forward direction bycomparing the previously processed input data stored at the historyaddresses received from hash block 222.

Match block 228 also determines whether at least one backward matchoccurs between the current byte position of the current byte string andthe history addresses of the one or more previous occurrences of bytestrings, the backward match including preceding byte positions in abackward direction of the input data stream (374). For backwardmatching, match block 228 may be configured to determine whether a bytesequence of one or more bytes beginning at each byte position in abackward direction matches a string of bytes at the identified historyaddress. In this way, for each byte position, match block 228 maydetermine match lengths in both the forward direction and the backwarddirection beginning at the current byte position. Match block 228 thensends an indication of whether the at least one forward match and the atleast one backward match occur for the current byte string to asubsequent block in the pipeline of search block 206, e.g. path block232, for use in compressing the input data stream based on the matches(376).

FIG. 25 is a flowchart illustrating an example data striping operationfor history-based data compression performed in accordance with thetechniques of this disclosure. The operation illustrated in FIG. 25 maybe performed by, e.g., the components of match block 228 from FIG. 13,or other devices in other examples. Furthermore, the operation of FIG.25 may be performed in a different order or with fewer operations thanwhat is shown in FIG. 25.

Match block 228 stores a history of an input data stream in historybuffer 230 across two or more memory banks of history buffer 230depending on an operational mode of match block 228 and a size of thehistory (380). In some examples, the memory banks of history buffer 230may be large enough to hold the entire history size allowed by aspecific compression algorithm. In other examples, however, the memorybanks of history buffer 230 may be smaller than the allowed historysize. The entire history may be stored in the memory banks by stripingthe history data across the memory banks.

Match block 228 receives one or more history addresses of potentialprevious occurrences of a current byte string beginning at a currentbyte position in the input data stream (382). Match block 228 determineswhether at least one match occurs for the current byte string from amongone or more previous occurrences of byte strings stored at the one ormore history addresses in history buffer 230 (384). Since most of theprevious occurrence matches are close to the current byte position, datastriping increases the available history size of smaller memory bankswhile reducing bank conflicts when attempting to access the history toperform match checking for two or more addresses in the same cycle.Match block 228 then sends an indication of whether the at least onematch occurs for the current byte string to a subsequent block in thepipeline of search block 206, e.g. path block 232, for use incompressing the input data stream based on the match (386).

FIG. 26 is a flowchart illustrating an example merging and outputselection operation for history-based data compression performed inaccordance with the techniques of this disclosure. The operationillustrated in FIG. 26 may be performed by, e.g., the components of pathblock 232 from FIG. 18, or other devices in other examples. Furthermore,the operation of FIG. 26 may be performed in a different order or withfewer operations than what is shown in FIG. 26.

Path block 232 receives an indication of whether at least one matchoccurs between a current byte string beginning at a current byteposition in an input data stream and one or more history addresses ofone or more previous occurrences of byte strings (390). When the atleast one match occurs for the current byte string, path block 232determines a best match for the current byte position (392). Morespecifically, path block 232 is configured to select the longest andclosest match at each byte position and merge consecutive matches toform a longer match. When selecting the longest and closest match, pathblock 232 may consider the following sources of potential matches:forward matches from the current byte position, backward matches fromsubsequent byte positions, and carry forward matches from previous bytepositions. In the case of carry forward matches, path block 232 may beconfigured to determine whether any matches from previous byte positionsin the input data stream overlap a current byte position, and, if so,determine a truncated length of the match at the current byte position.

Path block 232 selects an output for the current byte position, whereinthe output for the current byte position comprises one of a reference tothe best match for the current byte string or a literal of original dataat the current byte position (394). For example, path block 232 may beconfigured to support lazy match in which path block 232 determineswhether it is better to output a length-distance pair to represent amatch beginning at the current byte position or to output a literal forthe current byte position based on matches at other byte positionswithin a configurable window. When a match initially selected as outputfor the current byte position has a maximum match length, path block 232may determine whether matches at any subsequent byte positions extendthe length of the initial match, and, if so, merge the matches to form alonger match at the current byte position. Path block 232 then transmitsthe selected output for the current byte position in an output datastream (396).

Various examples have been described. These and other examples arewithin the scope of the following claims.

What is claimed is:
 1. A method comprising: receiving, by a match blockof a search engine of a processing device, one or more history addressesof potential previous occurrences of a current byte string beginning ata current byte position in an input data stream; determining, by thematch block, whether at least one forward match occurs between thecurrent byte position of the current byte string and the historyaddresses of one or more previous occurrences of byte strings, theforward match including subsequent byte positions in a forward directionof the input data stream, wherein the history addresses comprise bytepositions of the previous occurrences of byte strings stored in ahistory buffer; determining, by the match block, whether at least onebackward match occurs between the current byte position of the currentbyte string and the history addresses of the one or more previousoccurrences of byte strings, the backward match including preceding bytepositions in a backward direction of the input data stream; and sending,by the match block and to a subsequent block of the search engine, anindication of whether the at least one forward match and the at leastone backward match occur for the current byte string for use incompressing the input data stream based on the matches.
 2. The method ofclaim 1, wherein determining whether the at least one forward matchoccurs for the current byte string comprises: reading the one or moreprevious occurrences of byte strings stored at the history addresses inthe history buffer; and comparing the current byte string beginning atthe current byte position to each of the one or more previousoccurrences of byte strings beginning at the history addresses on abyte-by-byte basis in the forward direction of the input data stream todetermine whether the at least one forward match occurs for the currentbyte string.
 3. The method of claim 1, wherein determining whether theat least one backward match occurs for the current byte stringcomprises: subtracting a given number of byte positions from each of thehistory addresses to generate respective modified history addresses;reading the one or more previous occurrences of byte strings stored atthe history addresses in the history buffer; and comparing the currentbyte string beginning at the current byte position to each of the one ormore previous occurrences of byte strings beginning at the historyaddresses on a byte-by-byte basis in the backward direction of the inputdata stream up to the respective modified history addresses to determinewhether the at least one backward match occurs for the current bytestring.
 4. The method of claim 1, wherein sending the indicationcomprises sending a literal of original data at the current byteposition and a number of matches, wherein each of the matches includes alength of any forward match and a length of any backward match for thecurrent byte string.
 5. The method of claim 1, wherein, when at leastone of the forward match or the backward match occurs for the currentbyte string, sending the indication comprises sending the literal oforiginal data at the current byte position and a number of matches setequal to at least one.
 6. The method of claim 1, wherein, when neitherthe forward match nor the backward match occurs for the current bytestring, sending the indication comprises sending the literal of originaldata at the current byte position and a number of matches set equal tozero.
 7. The method of claim 1, further comprising: storing the inputdata stream in a lookahead buffer; and once the current byte position inthe input data stream is past a last byte position of a given chunk ofdata in the input data stream, writing the given chunk of data from thelookahead buffer to the history buffer.
 8. The method of claim 1,wherein the history buffer is configured to include multiple memorybanks, and wherein determining whether the at least one forward matchand the at least one backward match occurs for the current byte stringcomprises scheduling as many accesses as possible for the historyaddresses to different memory banks of the history buffer during one ormore clock cycles.
 9. The method of claim 8, further comprising, whenaccesses for two history addresses are scheduled to a same one of thememory banks of the history buffer during a same clock cycle and ascheduling entry for one of the history addresses cannot be rescheduledduring a subsequent clock cycle, discarding the scheduling entry for theone of the history addresses and not reading a previous occurrence of abyte string stored at the one of the history addresses in the historybuffer.
 10. The method of claim 1, wherein the match block is configuredto operate in a multi-thread mode, and wherein the history buffercomprises a large history buffer and a small history buffer, the methodfurther comprising: configuring the large history buffer to includemultiple large memory banks with each of the large memory banks storinga full history of the input data stream per thread; and configuring thesmall history buffer to include multiple small memory banks storing amost recent portion of the full history across all of the small memorybanks per thread.
 11. The method of claim 1, wherein the match block isconfigured to operate in a single thread mode, and wherein the historybuffer comprises a large history buffer and a small history buffer, themethod further comprising: configuring the large history buffer toinclude multiple large memory banks storing a full history of the inputdata stream across all of the large memory banks; and configuring thesmall history buffer to include multiple small memory banks storing amost recent portion of the full history across all of the small memorybanks.
 12. A processing device comprising: a memory configured to storea history buffer; and a match block of a search engine of the processingdevice, the match block configured to: receive one or more historyaddresses of potential previous occurrences of a current byte stringbeginning at a current byte position in an input data stream; determinewhether at least one forward match occurs between the current byteposition of the current byte string and the history addresses of one ormore previous occurrences of byte strings, the forward match includingsubsequent byte positions in a forward direction of the input datastream, wherein the history addresses comprise byte positions of theprevious occurrences of byte strings stored in the history buffer;determine whether at least one backward match occurs between the currentbyte position of the current byte string and the history address for theone or more previous occurrences of byte strings, the backward matchincluding preceding byte positions in a backward direction of the inputdata stream; and send, to a subsequent block of the search engine, anindication of whether the at least one forward match and the at leastone backward match occur for the current byte string for use incompressing the input data stream based on the matches.
 13. The deviceof claim 12, wherein, to determine whether the at least one forwardmatch occurs for the current byte string, the match block is configuredto: read the one or more previous occurrences of byte strings stored atthe history addresses in the history buffer; and compare the currentbyte string beginning at the current byte position to each of the one ormore previous occurrences of byte strings beginning at the historyaddresses on a byte-by-byte basis in the forward direction of the inputdata stream to determine whether the at least one forward match occursfor the current byte string.
 14. The device of claim 12, wherein, todetermine whether the at least one backward match occurs for the currentbyte string, the match block is configured to: subtract a given numberof byte positions from each of the history addresses to generaterespective modified history addresses; read the one or more previousoccurrences of byte strings stored at the history addresses in thehistory buffer; and compare the current byte string beginning at thecurrent byte position to each of the one or more previous occurrences ofbyte strings beginning at the history addresses on a byte-by-byte basisin the backward direction of the input data stream up to the respectivemodified history addresses to determine whether the at least onebackward match occurs for the current byte string.
 15. The device ofclaim 12, wherein, to send the indication, the match block is configuredto send a literal of original data at the current byte position and anumber of matches, wherein each of the matches includes a length of anyforward match and a length of any backward match for the current bytestring.
 16. The device of claim 12, wherein, when at least one of theforward match or the backward match occurs for the current byte string,the match block is configured to send the literal of original data atthe current byte position and a number of matches set equal to at leastone.
 17. The device of claim 12, wherein, when neither the forward matchnor the backward match occurs for the current byte string, the matchblock is configured to send the literal of original data at the currentbyte position and a number of matches set equal to zero.
 18. The deviceof claim 12, wherein the match block is configured to: store the inputdata stream in a lookahead buffer; and once the current byte position inthe input data stream is past a last byte position of a given chunk ofdata in the input data stream, write the given chunk of data from thelookahead buffer to the history buffer.
 19. The device of claim 12,wherein the history buffer is configured to include multiple memorybanks, and wherein, to determine whether the at least one forward matchand the at least one backward match occurs for the current byte string,the match block is configured to schedule as many accesses as possiblefor the history addresses to different memory banks of the historybuffer during one or more clock cycles.
 20. The device of claim 19,wherein the match block is configured to, when accesses for two historyaddresses are scheduled to a same one of the memory banks of the historybuffer during a same clock cycle and a scheduling entry for one of thehistory addresses cannot be rescheduled during a subsequent clock cycle,discard the scheduling entry for the one of the history addresses andnot read a previous occurrence of a byte string stored at the one of thehistory addresses in the history buffer.
 21. The device of claim 12,wherein the match block is configured to operate in a multi-thread mode,wherein the history buffer comprises a large history buffer and a smallhistory buffer, and wherein the match block is configured to: configurethe large history buffer to include multiple large memory banks witheach of the large memory banks storing a full history of the input datastream per thread; and configure the small history buffer to includemultiple small memory banks storing a most recent portion of the fullhistory across all of the small memory banks per thread.
 22. The deviceof claim 12, wherein the match block is configured to operate in asingle thread mode, wherein the history buffer comprises a large historybuffer and a small history buffer, and wherein the match block isconfigured to: configure the large history buffer to include multiplelarge memory banks storing a full history of the input data streamacross all of the large memory banks; and configure the small historybuffer to include multiple small memory banks storing a most recentportion of the full history across all of the small memory banks.